The quiz questions are designed to test your knowledge of the material covered in this hour . The answers to the questions follow.
How many nodes are shown in Figure 19.1?
Five. There are three elements and two text nodes for a total of five nodes.
Name the nodes in the XML document <test>Hello World!</test> .
There is the test node and the text node under it containing "Hello World!".
What two steps need to be done to insert a new node into an XML document?
You need to first use createElement or createTextNode to make the node and then use appendChild or, alternatively, insertBefore , to put the node in the XML object.
How would you get to the text "Hello World" in the document <test>Hello World!</test> ?
The text is the nodeValue of the first child of the first child. So you could do this: myXML.childNodes.childNodes.nodeValue .