Revision [1126]
This is an old revision of CommandXsplit made by DavidLee on 2010-01-07 12:24:24.
Command xsplit
Name
xsplit Splits an xmlfile into multiple filesSynopsis
xsplit [ serialization options ] [-w string|element] [-c children] [-n] [-p prefix] [-s suffix] [-e ext] [file]Description
Splits a single xml file into multiple xml files.-wrap string -w string | Wraps each xml file with an element named "string" |
-wrap element -w element | Wraps each xml file with the specified element |
-children children -c children | Number of child elements to put in each file (default=1) |
-nowrap -n | Do not wrap a root element around each element |
-prefix prefix -p prefix | Prefix string to use for creating filename. (default="x") |
-suffix suffix -s suffix | Suffix string to use for creating filename. (default="") |
-ext ext -e ext | Extension to use for creating filename. (default=".xml") |
-output dir -o dir | Output to direcotry (default=".") |
-noPI | Do not output processing instructions in split files |
-noDTD | Do not output DTD instructions in split files |
Supports the standard [ serialization options ]
If no files are specified, then stdin is read.
If a -w argument is given the output files are wrapped with the supplied container element instead of the root element of the input.
Output files are created by reading up to the root element, and replicating that markup including either the root element,
the wrap element or no root element, then for each (n) child element(s) of the root creating a new xml file with the common header
elements.
If the -n flag is used (do not wrap children) then "-c 1" is presumed. Namespace nodes, if any, from the root element will be copied to each child element which will become the document root of each split file.
Implementation Note: xsplit is designed to work with large files. All processing is done in streaming mode on both input and output. This means xsplit can split up files with input *and output* exceed available memory. The side effect is that the options are limited. Arbitrary xpath expressions cannot be used to determine the split points or output files names. Consider combining with the xquery command to further split files once they are manageable size, and with xmove to rename the files to a more usable name based on information within the resulting file.
Commands
CategoryCommands