XmlSplit Examples
All examples follow these steps:
- Files Tab: Select an XML file
- Methods Tab: Choose one of the split methods
- Options Tab: Choose the options specified in the example
- Split Tab: Click the Split button to create the output files on disk or Preview button to view them in a separate window
Example 1: Split every 10 elements at depth 1.
View details.
- Insert root element of the source XML document in every split file.
Example 2: Split every 20 elements at depth 1.
View details.
- Insert root element of the source XML document in every split file.
- Write each split file in utf-16 (unicode) encoding.
- Write the byte order mark in each split file.
Example 3: Split every 20 elements and write header in each file.
View details.
- Insert root element of the source XML document in every split file.
- Write the header element in each split file.
- Use the Threshold option to skip unwanted nodes.
Example 4: Split upon change of tag name of Element at depth 1.
View details.
Example 5: Split upon change of value of attribute "ID" in elements at depth 1.
View details.
Example 6: Split every 10 elements at depth 2 and preserve XML hierarchy.
View details.
- Uses the Preserve Structure option.
Example 7: Split a complex XML structure.
View details.
- Uses the Preserve Structure option.
- Uses the Threshold Element option.
- Splits elements with a depth = 3 regardless of its name.
Include and Append Files.
These two options are not covered in the above examples because newer options such as Preserve Structure, Threshold Element and Write Header made them
largely obsolete. In the event they are needed, they do what their names imply. If an include file is specified it is inserted at the very beginning of each split file, while and append file is appended to the end.
A few definitions
Root: the root element of an XML document. There can be only one root element and it has a depth = 0. All other nodes are nested within the root as "child" nodes.
Depth: the nesting level of an element in the XML hierarchy. The root element always
has a depth of zero. End tags have the same depth as their start tag .
Depth
0 <ORDERS>
1 <ORDERS_HEADER>
2 <O_DATE-RANGE>1990-1999</O_DATE-RANGE>
1 </ORDERS_HEADER>
1 <ORDER>
2 <O_ORDERKEY>1</O_ORDERKEY>
2 <O_CUSTKEY>370</O_CUSTKEY>
1 </ORDER>
0 </ORDERS>
Copyright Ⓒ 2008-2023. Xponent LLC. All rights reserved.