Example 2: Split every 20 elements at depth 1.

  • Insert root element of the source XML document in each split file.
  • Write each split file in utf-16 (unicode) encoding.
  • Write the byte order mark in each split file.
  • Write the XmlDeclaration in each split file.
Sample XML file orders.xml containing 50 ORDER elements

Method A on the Methods Tab is used in this example(see methods tab image for Example 1).

The XML document in this example contains an XmlDeclaration, which is an optional XML node. If it appears it must be the first node in XML document. If you want it written in each split file, check the Preserve Structure checkbox on the Options tab. Otherwise, it is writton only to the first split file.

Preserve Structure takes all the XML nodes from the source document up to, but not including, the first ORDERS element (the element specified for splitting) and writes them to the beginning of each split file.

If you want the split files to be in the utf-16 (unicode) encoding, select it in the dropdown combo box on the Options tab. Also, it is recommended that for utf-16 (unicode) encoding, check the write byte order mark option which helps software applications that parse XML to know what the encoding is. XML parsers will assume utf-8 if there is no byte order mark and no encoding attribute in the XmlDeclaration. The byte order mark itself is not part of an XML document so it does not appear.

Wizard Options For this example
example1

First two split files created are below:

Split file 1.

Split file 2.