Q: What elements does XML-DBMS choose to process?

Applies to: 2.0

XML-DBMS processes mapped subtrees of the document. A mapped subtree is a subtree in which:

An additional restriction is:

For example, suppose you have the following document and want to map the subtrees shown in bold (D, C/F-G/J, and E/I/L) to the database. (For simplicity, elements mapped to columns, attributes, and PCDATA are not shown.)

               A
             _/ \_
            /     \
           B       C
          / \     / \
         D   E   F   G
            / \      |
           H   I     J
           |   |
           K   L
           |
           M

These would be mapped to three separate sets of tables:

To map the D subtree, you need the following elements in the map document:

To map the C/F-G/J subtree, you need the following elements in the map document:

To map the E/I/L subtree, you need the following elements in the map document. (The InlineMap element for I tells XML-DBMS to skip I but process L. For more information, click here.)

Note, for example, that it is not possible to map the K/M subtree. This is because it has an ancestor (E) that is mapped and to which the K/M subtree is not connected by mapped elements. That is, there is an unmapped element (H) between the subtree and its mapped ancestor.

A note on processing

XML-DBMS processes an XML document by traversing the document hierarchy in depth-first, width-second order and processing the mapped subtrees it finds:

  1. XML-DBMS starts at the root element and traverses the document until it finds an element mapped with a ClassMap. This marks the root of a mapped subtree.

  2. XML-DBMS transfers data for this element and all of its mapped descendants. It stops on any unmapped branch. (This is why it cannot process mapped subtrees that are disconnected from mapped ancestors.)

  3. After XML-DBMS has processed the entire mapped subtree, it goes back to the root of the mapped subtree, finds its next sibling, and starts processing again. If the root of the subtree has no sibling, XML-DBMS moves up a level and continues (and so on).

Back to the XML-DBMS FAQs