O'Reilly logo

Inside XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

XML and Hierarchical Data

One of the most interesting developments in database handling is the capability to create hierarchical recordsets, where a record can actually contain an entire new recordset. XML documents represent a perfect way of storing hierarchical recordsets because you can enclose one set of elements inside another easily.

Here's an example; in this case, I'm adding records about deliveries made to the customers in customer.xml in a new XML document, deliveries.xml:

 <?xml version="1.0"?> <CUSTOMERS> <CUSTOMER> <NAME>Charles</NAME> <RECORD> <CUSTOMER_ID>58704</CUSTOMER_ID> <PURCHASE_DATE>10/15/2001</PURCHASE_DATE> <DEPARTMENT>Meat</DEPARTMENT> <PRODUCT_NAME>Ham</PRODUCT_NAME> <DELIVERY> <DATE>10/20/2001</DATE> <TOTAL_COST>$1.99</TOTAL_COST> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required