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> ...

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