Reading Data That Has Multiple Layers of Nodes

As you've probably determined from the previous exercise, the DSO object provides a great deal of functionality. When an XML file is linked to a DSO object, that object immediately understands the entire structure of the file. This can also be used to read the data from a file where there are multiple layers of nodes.

Listing 10.6 will be your data source, and it's saved as listing10-6.xml.

Listing 10.6 A Data File That Contains Several Levels of Nodes
 1: <?xml version="1.0"?> 2: <!-- This file is the data component of an instance of the 3: Book object. The name of the file is 4: xmlhour10-6.xml. --> 5: <Book> 6: <Title>Teach Yourself XML in 24 Hours</Title> 7: <Author> 8: <Name>Charles Ashbacher</Name> ...

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.