Preserving the Root Element
You can include the root element in the generated record by enabling the Preserve Root Element property.
- Omit a delimiter
- When you omit a delimiter to generate a single record, the root element is the root element of the XML document.
- Specify a delimiter
- When you specify a delimiter to generate multiple records, the root element is the XML element specified as the delimiter element or is the last XML element in the simplified XPath expression specified as the delimiter element.
<?xml version="1.0" encoding="UTF-8"?>
<bookstore xmlns:prc="http://books.com/price">
<b:book xmlns:b="http://books.com/book">
<title lang="en">Harry Potter</title>
<prc:price>29.99</prc:price>
</b:book>
<b:book xmlns:b="http://books.com/book">
<title lang="en_us">Learning XML</title>
<prc:price>39.95</prc:price>
</b:book>
</bookstore>
Root Element when Omitting a Delimiter
If you omit a delimiter to generate a single record, the root element is
bookstore
, the root element of the XML document.
When you enable the Preserve Root Element property, Data Collector
generates the following record, including bookstore
as the root
element:
When you disable the Preserve Root Element property, Data Collector
generates the following record, removing the bookstore
root
element:
Root Element when Specifying a Delimiter
If you specify book
as the delimiter element to generate multiple
records, the root element is book
.
When you enable the Preserve Root Element property, Data Collector
generates the following records, including book
as the root element
of both records:
When you disable the Preserve Root Element property, Data Collector
generates the following records, removing book
as the root element
from both records:
Similarly, if you specify the XPath expression
/bookstore/book/author
as the delimiter element to generate
multiple records, the root element is author
. Data Collector
includes author
in the generated records based on the Preserve Root
Element property.