Usage:
xmltool indentindent_optionsvalidate_optionscommon_options[xml_file]*
Save, possibly indenting and/or flattening[1], specified XML files.
save_file_or_dirSpecifies where to save all specified documents.
If a single document is to be saved, save_file_or_dir may specify a file or an existing directory.
If multiple documents are to be saved, save_file_or_dir must specify a directory. Such directory is automatically created if it does not already exist.
Default: reuse the original filename of each specified document after renaming this document using a ".BAK" filename.
Do not preserve inclusions. Instead ``flatten'' a document.
Default: preserve inclusions.
integerSpecifies the number of space characters used to indent a child element relatively to its parent element.
A positive or null value means: indent always.
Value "-1" means: never indent.
Any other negative value means indent, but only if the document to be saved has an actual document type. In such case, the number of space characters is: (-2 - integer).
Default: -4.
positive_integerSpecifies the maximum line length for elements containing text interspersed with child elements.
Default: 78.
Do not add open lines between the child elements of elements having an ``element-only'' content model.
Default: add open lines.
Do no attempt to create an XML file which favors the interoperability with HTML/SGML.
Default: favor interoperability with HTML/SGML.
Do not save characters not supported by the encoding as entity references. Instead, save them as numeric references.
Default: when possible and when needed to, save characters as entity references.
list_of_chars_or_char_rangesAlways save specified characters as entity references.
Example: -specialchars "reg 174 0x00ae 0256 pound:yen 163:165 0xA3:0xA5 0243:0245".
No default.
list_of_simple_XPathsSave the textual contents of specified elements as CDATA sections.
XHTML example: -cdatasections "htm:script htm:style".
No default.
namespaceAssociates a prefix to a namespace.
Multiple "-prefix" options are allowed.
This may be needed to allow parsing the XPaths argument of the above "-cdatasections" option. Options "-prefix" must precede the "-cdatasections" option.
XHTML example: -prefix htm http://www.w3.org/1999/xhtml.
No default.
Do not use the namespace prefixes originally specified in the document. Instead, generate prefixes.
Default: Reuse the original prefixes as much as possible.
Do not use the default namespace originally specified in the document.
Default: Reuse the default namespace if any.
Specifies the "version" pseudo-attribute of the XML declaration. "original" means: reuse the XML version originally specified in the document.
Default: original.
java_supported_encoding|originalSpecifies which encoding to use when saving a document. "original" means: reuse the encoding originally specified in the "encoding" pseudo-attribute of the XML declaration of the document.
Default: original.
Specifies the "standalone" pseudo-attribute of the XML declaration. "original" means: reuse the "standalone" pseudo-attribute originally specified in the document.
No default: do not add a "standalone" pseudo-attribute to the XML declaration.
Do not save specified documents if any of them is found to have validity errors (even harmless cross-reference errors).
Default: save documents even if some of them are found to be invalid.
Example: Indent docbook-table.xml using the default settings. The original docbook-table.xml is saved to docbook-table.xml.BAK.
/opt/xxe/demo$ xmltool indent docbook-table.xml /opt/xxe/demo$ ls docbook-table.xml* docbook-table.xml docbook-table.xml.BAK
Example: Indent docbook-table.xml using specified settings. Save indented file to out.xml.
/opt/xxe/demo$ xmltool indent -indent 1 -noopenlines -nolegacy -o out.xml docbook-table.xml
Example: Force the indentation of schema-less file xhtml_strict.xxe.
/opt/xxe/addon/config/xhtml$ xmltool indent -indent 2 -o indented.xxe xhtml_strict.xxe WARNING: Cannot determine which schema to use for validating "xhtml_strict.xxe".
Example: Indent all .xhtml files contained in current directory. Create save files in directory /tmp/out/.
/opt/xxe/demo$ xmltool indent -v -encoding Windows-1252 -o /tmp/out *.xhtml
Example: Transclude all XInclude elements contained docbook-modular-book.xml (-f is needed otherwise out.xml would contain a number of duplicate ID errors).
/opt/xxe/demo$ xmltool indent -xi -f -flat -o out.xml docbook-modular-book.xml