XML and Hierarchical Data

One of the most interesting developments in database handling is the capability to create hierarchical recordsets, in which 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 ch08_03.xml in a new XML document, ch08_09.xml:

Listing . ch08_09.xml
 
<?xml version="1.0"?>
<CUSTOMERS>
    <CUSTOMER>
        <NAME>Charles</NAME>
        <RECORD>
            <CUSTOMER_ID>58704</CUSTOMER_ID>
            <PURCHASE_DATE>10/15/2003</PURCHASE_DATE>
            <DEPARTMENT>Meat</DEPARTMENT>
            <PRODUCT_NAME>Ham</PRODUCT_NAME>
            <DELIVERY>
					<DATE>10/20/2003</DATE> ...

Get Real World XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.