Example 1: Split every 10 elements at depth 1.

  • The root element of the source XML file in written to each split file.
Sample XML file orders.xml containing 50 ORDER elements

Files Tab is used to select the XML document to be split. The program automatically fills the textbox for the output file if it is empty. The default file name split.xml is used as a base name: each split file created uses this name and adds an auto-incrementing number, e.g., split1.xml, split2.xml, etc.

Files

Method A on the Methods Tab is used in this example.

example1

When the XML document is selected in the Files tab, XmlSplit automatically fills in the root element in the Options tab. When the split process starts, XmlSplit takes the root element from the options tab and writes it to each split file. The user may change the root element input. If it is blank, the split files will not have a root element and will therefore not be correctly structured XML files. It also attempts to locate a repeating element suitable for splitting and if found, inserts its name in the element input and its corresponding depth input.

In this example, five split files are created, each with ten ORDER elements. For each split file, the program writes the specified ORDERS root element and then writes each element with a depth of 1, including child nodes. When 10 ORDER elements have been written, a new split file is created and these steps are repeated until the end of the source XML document has been reached. All child nodes are written.

The input box for element name is blank because in the sample file all elements named ORDER have a depth of 1. If the file had other elements at depth one, then they would have been counted in the specified count of 10. To include only elements with a specific name, enter the name in the optional name input. The name may be dragged from the XML Viewer and dropped into the name input and doing so automatically updates the depth input with the correct value.

Note that on the options tab, the input box for the root element is automatically filled when the XML file is selected. You may type in different root element. Edits are checked for correct XML syntax. It may be blanked out, but the split files will not be well-formed XML without a root element.

Wizard Options For this example
example1

First two split files created are below:

Split file 1.

Split file 2.