| 1: | How many nodes are shown in Figure 19.1? |
| A1: | Five. There are three elements and two text nodes for a total of five nodes. |
| 2: | Name the nodes in the XML document <test>Hello World!</test> . |
| A2: | There is the test node and the text node under it containing "Hello World!". |
| 3: | What two steps need to be done to insert a new node into an XML document? |
| A3: | 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. |
| 4: | How would you get to the text "Hello World" in the document <test>Hello World!</test> ? |
| A4: | The text is the nodeValue of the first child of the first child. So you could do this: myXML.childNodes[0].childNodes[0].nodeValue . |