Traversing a Node Tree

In previous hours, you constructed hierarchical tree diagrams corresponding to XML files. In those diagrams, you concentrated only on the data portions of the XML files. However, every file entry that's surrounded by tags is considered a node, even the comments.

For example, consider Listing 8.1.

Listing 8.1 A Small Example to Demonstrate a Node Tree
 1: <?xml version="1.0"?> 2: <!-- This file is our first example of using the data type qualifiers 3: supported in XML to further refine the form of our data. --> 4: <Book xmlns:dt="urn:schemas-microsoft-com:datatypes"> 5: <Grade dt:dt="char">A</Grade> 6: <OneSignedInteger dt:dt="i1">12</OneSignedInteger> 7: <TwoSignedInteger dt:dt="i2">-12</TwoSignedInteger> 8: <OneUnsignedInteger ...

Get Sams Teach Yourself XML in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.