/ .. / / -> download
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dmodule>
<dmodule xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.s1000d.org/S1000D_4-2/xml_schema_flat/descript.xsd">
  <identAndStatusSection>
    <dmAddress>
      <dmIdent>
        <dmCode modelIdentCode="XMLUTILS" systemDiffCode="A" systemCode="05" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="040" infoCodeVariant="A" itemLocationCode="D"/>
        <language languageIsoCode="en" countryIsoCode="CA"/>
        <issueInfo issueNumber="008" inWork="01"/>
      </dmIdent>
      <dmAddressItems>
        <issueDate year="2020" month="07" day="07"/>
        <dmTitle>
          <techName>xml-format(1) | xml-utils</techName>
        </dmTitle>
      </dmAddressItems>
    </dmAddress>
    <dmStatus issueType="changed">
      <security securityClassification="01"/>
      <responsiblePartnerCompany>
        <enterpriseName>khzae.net</enterpriseName>
      </responsiblePartnerCompany>
      <originator>
        <enterpriseName>khzae.net</enterpriseName>
      </originator>
      <applic>
        <displayText>
          <simplePara>All</simplePara>
        </displayText>
      </applic>
      <brexDmRef>
        <dmRef>
          <dmRefIdent>
            <dmCode modelIdentCode="S1000D" systemDiffCode="F" systemCode="04" subSystemCode="1" subSubSystemCode="0" assyCode="0301" disassyCode="00" disassyCodeVariant="A" infoCode="022" infoCodeVariant="A" itemLocationCode="D"/>
          </dmRefIdent>
        </dmRef>
      </brexDmRef>
      <qualityAssurance>
        <unverified/>
      </qualityAssurance>
      <reasonForUpdate id="rfu-xml-catalog" updateHighlight="1" updateReasonType="urt02">
        <simplePara>Add --xml-catalog parser option.</simplePara>
      </reasonForUpdate>
    </dmStatus>
  </identAndStatusSection>
  <content>
    <description>
      <levelledPara>
        <title>NAME</title>
        <para>xml-format - Format XML files</para>
      </levelledPara>
      <levelledPara>
        <title>SYNOPSIS</title>
        <para>
          <verbatimText verbatimStyle="vs24">xml-format [-cfIOwh?] [-i <str>] [-o <path>] [<file>...]</verbatimText>
        </para>
      </levelledPara>
      <levelledPara>
        <title>DESCRIPTION</title>
        <para>The <emphasis>xml-format</emphasis> utility pretty prints an XML document by removing ignorable blank nodes and indenting the XML tree.</para>
        <para>A text node is considered ignorable if:</para>
        <para>
          <randomList>
            <listItem>
              <para>its parent does not set or inherit xml:space as "preserve"</para>
            </listItem>
            <listItem>
              <para>its contents are entirely whitespace</para>
            </listItem>
            <listItem>
              <para>all its sibling text nodes are also ignorable</para>
            </listItem>
            <listItem>
              <para>all its ancestors contained only ignorable text nodes</para>
            </listItem>
          </randomList>
        </para>
      </levelledPara>
      <levelledPara>
        <title>OPTIONS</title>
        <para>
          <definitionList>
            <definitionListItem>
              <listItemTerm>-c, --compact</listItemTerm>
              <listItemDefinition>
                <para>Output in compact form without indenting.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-f, --overwrite</listItemTerm>
              <listItemDefinition>
                <para>Overwrite input XML files.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-h, -?, --help</listItemTerm>
              <listItemDefinition>
                <para>Show usage message.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-I, --indent-all</listItemTerm>
              <listItemDefinition>
                <para>Indent nodes within non-blank nodes. Normally, all whitespace within non-blank nodes and their descendants is treated as significant.</para>
                <para>If -c (--compact) is specified, then this option will allow blank nodes within non-blank nodes to be compacted.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-i, --indent <str></listItemTerm>
              <listItemDefinition>
                <para>Use <str> to indent each level of the XML tree. The default is two spaces.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-O, --omit-decl</listItemTerm>
              <listItemDefinition>
                <para>Omit the XML declaration from the formatted XML output.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-o, --out <path></listItemTerm>
              <listItemDefinition>
                <para>Output formatted XML to <path> instead of stdout.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-w, --empty</listItemTerm>
              <listItemDefinition>
                <para>Treat elements containing only whitespace as empty.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--version</listItemTerm>
              <listItemDefinition>
                <para>Show version information.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm><file>...</listItemTerm>
              <listItemDefinition>
                <para>XML file(s) to format. If none are specified, the utility will read from stdin.</para>
              </listItemDefinition>
            </definitionListItem>
          </definitionList>
        </para>
        <para>
          In addition, the following options allow configuration of the XML parser:
          <definitionList>
            <definitionListItem>
              <listItemTerm>--dtdload</listItemTerm>
              <listItemDefinition>
                <para>Load the external DTD.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--huge</listItemTerm>
              <listItemDefinition>
                <para>Remove any internal arbitrary parser limits.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--net</listItemTerm>
              <listItemDefinition>
                <para>Allow network access to load external DTD and entities.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--noent</listItemTerm>
              <listItemDefinition>
                <para>Resolve entities.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--xinclude</listItemTerm>
              <listItemDefinition>
                <para>Do XInclude processing.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem changeMark="1" changeType="add" reasonForUpdateRefIds="rfu-xml-catalog">
              <listItemTerm>--xml-catalog <file></listItemTerm>
              <listItemDefinition>
                <para>Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times.</para>
              </listItemDefinition>
            </definitionListItem>
          </definitionList>
        </para>
      </levelledPara>
      <levelledPara>
        <title>EXAMPLES</title>
        <para>
          Raw XML:
          <verbatimText verbatimStyle="vs24">$ cat test.xml
<section>     <title>Example</title>

<para><emphasis>A</emphasis> <emphasis>B</emphasis> C</para>

<empty>    </empty>

<p><b>A</b> <b>B</b> <b>C</b></p>
<p xml:space="preserve"><b>A</b> <b>B</b> <b>C</b></p>

<para>
    See the following list:
    <randomList>
      <listItem><para>A</para></listItem>
      <listItem><para>B</para></listItem>
      <listItem><para>C</para></listItem>
    </randomList>
</para>

</section>
          </verbatimText>
        </para>
        <para>
          Basic formatting:
          <verbatimText verbatimStyle="vs11">$ xml-format test.xml
<section>
  <title>Example</title>
  <para><emphasis>A</emphasis> <emphasis>B</emphasis> C</para>
  <empty>    </empty>
  <p>
    <b>A</b>
    <b>B</b>
    <b>C</b>
  </p>
  <p xml:space="preserve"><b>A</b> <b>B</b> <b>C</b></p>
  <para>
    See the following list:
    <randomList>
      <listItem><para>A</para></listItem>
      <listItem><para>B</para></listItem>
      <listItem><para>C</para></listItem>
    </randomList>
  </para>
</section></verbatimText>
        </para>
        <para>
          Using the -I (--indent-all) option:
          <verbatimText verbatimStyle="vs11">$ cat test1.xml
<para>
  See the following list:
  <randomList>
    <listItem><para>A</para></listItem>
    <listItem><para>B</para></listItem>
    <listItem><para>C</para></listitem>
  </randomList>
</para>

$ xml-format -I test1.xml
<para>
  See the following list:
  <randomList>
    <listItem>
      <para>A</para>
    </listItem>
    <listItem>
      <para>B</para>
    </listItem>
    <listItem>
      <para>C</para>
    </listItem>
  </randomList>
</para></verbatimText>
        </para>
        <para>
          Using the -c (--compact) option:
          <verbatimText verbatimStyle="vs11">$ xml-format test.xml
<section><title>Example</title><para><emphasis>A</emphasis> <emphasis
>B</emphasis> C</para><empty>    </empty><p xml:space="preserve"><b>A
</b> <b>B</b> <b>C</b></p><para>
    See the following list:
    <randomList>
      <listItem><para>A</para></listItem>
      <listItem><para>B</para></listItem>
      <listItem><para>C</para></listItem>
    </randomList>
</para></section></verbatimText>
        </para>
        <para>
          Using the -c (--compact) and -I (--indent-all) options together:
          <verbatimText verbatimStyle="vs11">$ xml-format -cI test.xml
<section><title>Example</title><para><emphasis>A</emphasis> <emphasis
>B</emphasis> C</para><empty>    </empty><p xml:space="preserve"><b>A
</b> <b>B</b> <b>C</b></p><para>
    See the following list:
    <randomList><listItem><para>A</para></listItem><listItem><para>B<
/para></listItem><listItem><para>C</para></listItem></randomList>
</para></section></verbatimText>
        </para>
      </levelledPara>
    </description>
  </content>
</dmodule>


/ gopher://khzae.net/0/s1000d/xml/xml-utils/src/utils/xml-format/doc/DMC-XMLUTILS-A-05-00-00-00A-040A-D_EN-CA.XML
Styles: Light Dark Classic