"XMLSplit has saved me immense amounts of time in working with large, unruly
XML files. The interface is easy to use, and the program itself is quick
and concise. All I can say is XMLSplit is awesome!"

Depth. Specifies the element depth in the XML hierarchy for inclusion.

Root Element. Encapsulates each split file with the specified
root. If it has attributes, it automatically handles the quotes so the entire root is properly quoted for the script engine.

Include File. The specified file is inserted at the beginning of each split file.
One use is to insert XML comments.

Append File. Inserts the specified file at the end of each
split file. When used with an Include File, each split file may be nested within multiple parent elements.

Threshold Element. Specifies the element in the source file at which the splitter begins processing, skipping over all preceding nodes.

Encoding. Specifies the encoding used to write the split files. utf-8, utf-16 and iso-8859-1 are currently supported.

Write Byte Order Mark. Specifies whether the splitter writes a byte order mark in each split file. This is useful when feeding the split files into other software that may either require it, or fire an exception if it occurs.

Write DOCTYPE. If a DOCTYPE node occurs, specifies if the splitter writes it in each split file, first only, or none. This is useful where a DTD containing named entities may not be available or needed.

How Does It Work?

The file to be split must be well-formed XML (correct XML syntax, element nesting, etc.). If it is not, processing stops and an error message is provided with
the error line number. Our XMLMax editor is efficent at locating and fixing such errors, especially in extremely large files.

The XmlSplit Wizard generates Powershell and Windows Script Host scripts that run XmlSplit in command-line mode.
The Wizard can also split the XML directly from its dialog where it reports progress and enables cancellation at any time.

XmlSplit uses an XmlReader to read and parse the input XML document. It evaluates the input parameters when each
node is read to determine if the node is to be written to the current split file or a new split file created.
Auto-numbered split files are named based on an output file parameter. It automatically handles file names with
spaces by encapsulating them with quotes.

Many XmlSplit customers receive large XML files electronically and need to split and import them into database tables. Calling an XmlSplit script from
another script allows the entire process to be fully automated.

It is possible to split several large XML documents in batch process as explained in this article.

Rate of execution is constant with respect to size of the file being split because only a small segment is read into memory.

If the source XML file has XML syntax errors, or characters not allowed in XML files, Xmlsplit will report the error and stop processing. We recommend our
XMLMax editor to fix such errors, particularly if the XML is very large.

Added an integrated XML viewer that supports unlimited file size and provides drag-drop into the element name input on the Methods tab.

Preserve structure option has a "Show" button the displays an editable list of the XML nodes that are auto-inserted at the beginning of each split file

Fixed a bug in the Split Size Method that could result in one additonal split file.

Fixed a bug that occured when the specified output file name had no extension,that resulted in the split files being written to the current app folder rather than
the specified output folder and were named with just the file counter.

The XML data below is part of a file with a complex structure in that it has prolog elements, a header element and repeating ORDER elements
at a depth two levels below the root element.

Suppose you need to split it such that each split file has the XmlDeclaration and the header element, excludes the comment after the XmlDeclaration,
and writes 1000 ORDER elements in each split file. Here is how to do this with XmlSplit:

Files tab: select the XML file, output folder and output file name for the split files.

Methods tab: select method 1, set the frequency to 1000, depth to 2 and element name to "ORDER".

Options tab: check the Preserve Structure option then click the Show button next to it. Delete the comment node that follows the XmlDeclaration and click OK.

Split tab: run the split, or use the Preview mode to confirm the ouput files are what you expect.

What if the XML has no repeating element? Suppose each ORDER element is named uniquely, such as ORDER1, ORDER2, ORDER3 and so on.
To split it the same way, i.e., every 1000 elements at depth 2, regardless of element name, simply leave the element name blank in the Methods tab.