Purchase Solution

XHTML and DOM

Not what you're looking for?

Ask Custom Question

Exercise 1

In the seminar, Listing 5 showed an improve JavaScript function for printElement() to traverse and list on the screen all elements of the DOM of the XML document in Listing 1. Improve this JavaScript function by adding the functionality to also list on the screen the attributes and their values for each element. Submit the entire XHTML document containing the complete JavaScript code to process the file orders.xml (make sure you test it against the orders.xml file in the examples.zip file).

Exercise 2

Create an XHTML document with the JavaScript code to open and build the DOM tree for orders.xml as in the seminar, but them also loads in and builds another DOM tree for another fileâ?¦ say orders2.xml as shown below

<orders>
<order>
<customerid limit="1500">65743</customerid>
<status>pending</status>
<item instock="Y" itemid="HS05">
<name>Nike Horse Shoes</name>
<price>120</price>
<qty>4</qty>
</item>
</order>
</orders>

Then build in the functionality to modify the DOM tree for the orders.xml by adding the order for customer ID 65734 from the above listing to the orders.xml DOM. Then list the contents of the orders.xml DOM to the screen to verify this. Please submit the XHTML file containing all the above JavaScript functionality.

(HINT â?¦ use the cloneNode() and appendChild() functions from the Node Functions table in the Seminar)

Purchase this Solution

Solution Summary

This solution involves use of JavaScript in order to process an XML file.

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Javscript Basics

Quiz on basics of javascript programming language.