I want to bind the title in HTML dynamically to an XML
No success help me, pls
As follows
<xml id= "Xmldso" >
<?xml version= "1.0"?>
<booklist>
<book>
<title>straight Talk about Computersyyyyyyyyyy</title>
<isbn>72-80088-005</isbn>
</book>
<book>
<title>straight Talk about Computersyyyyyyyyyy</title>
<isbn>72-80088-005</isbn>
</book>
</booklist>
</XML>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<label id=title datasrc= #xmldso datafld= "title" ></LABEL>
<label id=title1 value= "DFF" ></LABEL>
<script language= "JavaScript" for= "Xmldso" >
<!--
var df=xmldso.booklist.book ("title");
alert (DF);
alert (Title1.value);
Document.title= "DD";
--here, I want to DOCUMENT.TITLE=DF;
-->
</SCRIPT>
<table border=1 datasrc= "#xmldso" >
<THEAD>
<TR><TH>Title</TH> <TH>ISBN</TH></TR>
</THEAD>
<TBODY>
<tr><td><div datafld= "title" ></DIV></TD>
<td><div datafld= "ISBN" > </DIV></TD>
</TR>
</TBODY>
</TABLE>
<HR>
<xml id= "Xmldso1" src= "Myxml.xml" > </XML>
<table border=1 datasrc= "#xmldso1" >
<THEAD>
<TR><TH> Title </TH> <TH> Publishing No. </TH></TR>
</THEAD>
<TBODY>
<tr><td><div datafld= "title" ></DIV></TD>
<td><div datafld= "ISBN" > </DIV></TD>
</TR>
</TBODY>
</TABLE>
</body>
Myxml.xml as follows, in fact this is useless, just for completeness.
Copy Code code as follows:
<?xml version= "1.0" encoding= "GBK"?>
<booklist>
<book>
<title> Computer Technology </title>
<isbn>72-80088-005</isbn>
</book>
<book>
<title> Electrician Technology </title>
<isbn>72-80081-082</isbn>
</book>
<book>
<title> Computer Software Technology </title>
<isbn>72-80088-005</isbn>
</book>
<book>
<title> Computer Repair Technology </title>
<isbn>72-80081-082</isbn>
</book>
</booklist>
XMLDSO is an XML DOM object that uses the DOM API when accessing. Write this:
Copy Code code as follows:
var books = Xmldso.selectsinglenode ("Booklist"). selectnodes ("book");
for (var i=0; i<books.length; i++) {
Alert (Books[i].selectsinglenode ("title"). Text);
}
About XMLDSO, I also want to say a few words, once did a project, the early stage is a few cows in Taiwan to do, using MVC, the following is my summary of the project:
XXX Framework:
XXX is the MVC pattern used, data, control, and view are separated from each other, JSP is responsible for view, the servlet is responsible for control, Datamodule is responsible for data access
Model section:
Advantages: Can be written in the event listener business logic, visual management, special support Master-detail (master table structure), look-up (lookup, so that the function is equivalent to the view in the database), format (formatted) and so on.
Disadvantage: Company employees must be familiar with Datamodule, Datamodule is not a mainstream technology, will not use many people-especially Java programmers.
The IDE generates a lot of code for Datamodule, but it also reduces a lot of SQL statements. The system often needs to operate multiple tables at the same time, in order to ensure the integrity of the data and the reliable execution of the complex operation, the Datamodule handles the transaction automatically. Reduces the programmer's development tasks.
Control Section:
Advantages:
Define the system's external behavior through pd.xml, such as adding, modifying, deleting, querying, including setting permissions (currently not done, but the design has been embodied), etc.
Converts the user's operation into a datamodule operation.
Select the appropriate view to display.
View section:
Advantages:
1): Front-End function (Onclick,onfocus,onblue,onchange), using XSLT, to reduce a large number of code for the JSP.
2): Display the use of Xml-dso,ie automatic data binding.
Disadvantages:
1): IE6 must be used. It is not normal to run with other systems.
2): Because of the use of XML-DSO, the programmer is highly demanding.
3): Because there are a lot of testing, calculation, in the client, resulting in the so-called "fat client", the result is: functional focus, not conducive to updating and maintenance.
Process
1): The client sends request requests to the server side.
2): Server-side through the control servlet to receive requests, by parsing request, allocated to the appropriate business Object
3) Controller will send some necessary request information, pass to Datamodule
4): Business object Update (add, modify, delete, etc.) Model,model Sync Database
5): Controller Implementation of JSP page, the implementation of the results are temporarily saved up.
6): Model information is packaged into XML data
1): The client sends request requests to the server side.
2): Server-side through the control servlet to receive requests, by parsing request, allocated to the appropriate business Object
3) Controller will send some necessary request information, pass to Datamodule
4): Business object Update (add, modify, delete, etc.) Model,model Sync Database
5): Controller Implementation of JSP page, the implementation of the results are temporarily saved up.
6): Model information is packaged into XML data
7): The XML data and JSP page of the implementation of the results of the combination of response to the client.