.\" Automatically generated by Pandoc 2.3.1 .\" .TH "xml\-format" "1" "2020\-07\-07" "" "xml\-utils" .hy .SH NAME .PP xml\-format \- Format XML files .SH SYNOPSIS .IP .nf \f[C] xml\-format\ [\-cfIOwh?]\ [\-i\ ]\ [\-o\ ]\ [...] \f[] .fi .SH DESCRIPTION .PP The \f[I]xml\-format\f[] utility pretty prints an XML document by removing ignorable blank nodes and indenting the XML tree. .PP A text node is considered ignorable if: .IP \[bu] 2 its parent does not set or inherit xml:space as "preserve" .IP \[bu] 2 its contents are entirely whitespace .IP \[bu] 2 all its sibling text nodes are also ignorable .IP \[bu] 2 all its ancestors contained only ignorable text nodes .SH OPTIONS .TP .B \-c, \-\-compact Output in compact form without indenting. .RS .RE .TP .B \-f, \-\-overwrite Overwrite input XML files. .RS .RE .TP .B \-h, \-?, \-\-help Show usage message. .RS .RE .TP .B \-I, \-\-indent\-all Indent nodes within non\-blank nodes. Normally, all whitespace within non\-blank nodes and their descendants is treated as significant. .RS .PP If \-c (\-\-compact) is specified, then this option will allow blank nodes within non\-blank nodes to be compacted. .RE .TP .B \-i, \-\-indent Use to indent each level of the XML tree. The default is two spaces. .RS .RE .TP .B \-O, \-\-omit\-decl Omit the XML declaration from the formatted XML output. .RS .RE .TP .B \-o, \-\-out Output formatted XML to instead of stdout. .RS .RE .TP .B \-w, \-\-empty Treat elements containing only whitespace as empty. .RS .RE .TP .B \-\-version Show version information. .RS .RE .TP .B ... XML file(s) to format. If none are specified, the utility will read from stdin. .RS .RE .PP In addition, the following options allow configuration of the XML parser: .TP .B \-\-dtdload Load the external DTD. .RS .RE .TP .B \-\-huge Remove any internal arbitrary parser limits. .RS .RE .TP .B \-\-net Allow network access to load external DTD and entities. .RS .RE .TP .B \-\-noent Resolve entities. .RS .RE .TP .B \-\-xinclude Do XInclude processing. .RS .RE .TP .B \-\-xml\-catalog Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times. .RS .RE .SH EXAMPLES .PP Raw XML: .IP .nf \f[C] $\ cat\ test.xml
\ \ \ \ \ Example A\ B\ C \ \ \ \

A\ B\ C

A\ B\ C

\ \ \ \ See\ the\ following\ list: \ \ \ \ \ \ \ \ \ \ A \ \ \ \ \ \ B \ \ \ \ \ \ C \ \ \ \
\ \ \ \ \ \ \ \ \ \ \f[] .fi .PP Basic formatting: .IP .nf \f[C] $\ xml\-format\ test.xml
\ \ Example \ \ A\ B\ C \ \ \ \ \ \ \ \

\ \ \ \ A \ \ \ \ B \ \ \ \ C \ \

\ \ A\ B\ C

\ \ \ \ \ \ See\ the\ following\ list: \ \ \ \ \ \ \ \ \ \ A \ \ \ \ \ \ B \ \ \ \ \ \ C \ \ \ \ \ \
\f[] .fi .PP Using the \-I (\-\-indent\-all) option: .IP .nf \f[C] $\ cat\ test1.xml \ \ See\ the\ following\ list: \ \ \ \ \ \ A \ \ \ \ B \ \ \ \ C \ \ $\ xml\-format\ \-I\ test1.xml \ \ See\ the\ following\ list: \ \ \ \ \ \ \ \ \ \ \ \ A \ \ \ \ \ \ \ \ \ \ \ \ \ \ B \ \ \ \ \ \ \ \ \ \ \ \ \ \ C \ \ \ \ \ \ \f[] .fi .PP Using the \-c (\-\-compact) option: .IP .nf \f[C] $\ xml\-format\ test.xml
ExampleA\ B\ C\ \ \ \ A \ B\ C

\ \ \ \ See\ the\ following\ list: \ \ \ \ \ \ \ \ \ \ A \ \ \ \ \ \ B \ \ \ \ \ \ C \ \ \ \
\f[] .fi .PP Using the \-c (\-\-compact) and \-I (\-\-indent\-all) options together: .IP .nf \f[C] $\ xml\-format\ \-cI\ test.xml
ExampleA\ B\ C\ \ \ \ A \ B\ C

\ \ \ \ See\ the\ following\ list: \ \ \ \ AB< /para>C
\f[] .fi .SH AUTHORS khzae.net.