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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.