Create an HTML document that performs the following Prompts

Create an HTML document that performs the following

Prompts for a URL for an XML document.

Retrieves the XML document

Implements logic to traverse an XML file within a JavaScript external file.

Updates the HTML page by building a dynamic table of the information (i.e., NodeName [ limit to elements or attributes ], NodeValue [limit to attributes & text notes associated with an element ], NodeType [limit to elements, attributes and text ] ) related to the nodes as they are traversed.

Solution

<?xml version =\"1.0\"?>
<!DOCTYPE DOCUMENT [
<!ELEMENT PURCHASE (CUSTOMER)+>
<!ELEMENT CUSTOMER (name,value,type)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT value (#PCDATA)>
<!ELEMENT type (#PCDATA)>
]>
<purchase>
   <customer>
       <name>Ramesh</name>
       <value>34</value>
       <type>A</type>  
   </customer>
   <customer>
       <name>Suresh</name>
       <value>36</value>
       <type>B</type>  
   </customer>
</purchase>

<html>
<head></head>
<body bgcolor = \"wheat\">
<br><br>
<xml id=\"rRecords\" src=\"reg.xml\"></xml>
<table id=\"emptable\" width=\"50%\" align=\"center\" border=\"2\"
bordercolor=\"blue\" cellspacing=\"0\" datasrc=\"#rRecords\" dataPageSize=\"5\">
<thead>
<tr style=\"background-color:cyan;color:blue;\">
<th>Name</th>
<th>Value</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td align = \"center\"><span datafld=\"name\"></span></td>
<td><span datafld=\"value\"></span></td>
<td><span datafld=\"type\"></span></td>
</tr>
</tbody>
</table>
<br><br>
<center>
<input type=\"button\" value=\"<< First\" onClick=\"emptable.firstPage()\">
<input type=\"button\" value=\"< Previous\" onClick=\"emptable.previousPage()\">
<input type=\"button\" value=\"Next >\" onClick=\"emptable.nextPage()\">
<input type=\"button\" value=\"Last >>\" onClick=\"emptable.lastPage()\">
<br><br>
<br><br><center>
</body>
</html>

Create an HTML document that performs the following Prompts for a URL for an XML document. Retrieves the XML document Implements logic to traverse an XML file w
Create an HTML document that performs the following Prompts for a URL for an XML document. Retrieves the XML document Implements logic to traverse an XML file w

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site