Data Binding with Complex XML

Listing 21.8 is a modified cats.xml. Two alterations have been made: Each cat element has been given a names attribute, and the name element has been subdivided with two nested elements. This file is no longer a flat XML file with a simple mapping to a recordset.

Listing 21.8. A Deeply Nested XML File: Cats2.xml
 <?xml version="1.0"?> <!-- this is cats2.xml-- > <cats> <cat names="Pierre "> <name> <givenname>Pierre</givenname> <nickname>PiPi</nickname> </name> <age>9</age> <sex>m</sex> <color>Gray and white</color> </cat> <cat names="Hergie "> <name> <givenname>Hergie</givenname> <nickname>Beautiful</nickname> </name> <age>16</age> <sex>f</sex> <color>Black</color> </cat> <cat names="Calloway"> <name> <givenname>Calloway</givenname> ...

Get XML Unleashed 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.