.. / 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="02" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="040" infoCodeVariant="A" itemLocationCode="D"/>
        <language languageIsoCode="en" countryIsoCode="CA"/>
        <issueInfo issueNumber="009" inWork="01"/>
      </dmIdent>
      <dmAddressItems>
        <issueDate year="2020" month="07" day="07"/>
        <dmTitle>
          <techName>xml-trim(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-trim - Trim whitespace in XML elements</para>
      </levelledPara>
      <levelledPara>
        <title>SYNOPSIS</title>
        <para>
          <verbatimText verbatimStyle="vs24">xml-trim [-e <elem> ...] [-N <ns=URL> ...] [-fnh?] <src>...</verbatimText>
        </para>
      </levelledPara>
      <levelledPara>
        <title>DESCRIPTION</title>
        <para>The <emphasis>xml-trim</emphasis> utility trims whitespace around the text contents of specified elements.</para>
        <para>Whitespace is trimmed according to the following rules:</para>
        <para>
          <sequentialList>
            <listItem>
              <para>Whitespace characters at the beginning of the first text node child of the specified elements are removed.</para>
            </listItem>
            <listItem>
              <para>Whitespace characters at the end of the last text node child of the specified elements are removed.</para>
            </listItem>
            <listItem>
              <para>If the -n option is given, sequences of whitespace characters in all text node children of the specified elements are converted to a single space.</para>
            </listItem>
          </sequentialList>
        </para>
      </levelledPara>
      <levelledPara>
        <title>OPTIONS</title>
        <para>
          <definitionList>
            <definitionListItem>
              <listItemTerm>-e, --element <elem></listItemTerm>
              <listItemDefinition>
                <para>Elements to trim space on. May include a namespace prefix if the namespace was registered with -N. <elem> may be either a simple element name (e.g., "para") which matches all elements with the same name at any position, or an XPath expression (e.g., "//section/para") for finer control.</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>-N, --namespace <ns=URL></listItemTerm>
              <listItemDefinition>
                <para>Registers an XML namespace handle for URL, which can then be used when specifying element names as options. Multiple namespaces can be registered by specifying this option multiple times.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>-n, --normalize</listItemTerm>
              <listItemDefinition>
                <para>Normalize space in the specified elements in addition to trimming whitespace.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm>--version</listItemTerm>
              <listItemDefinition>
                <para>Show version information.</para>
              </listItemDefinition>
            </definitionListItem>
            <definitionListItem>
              <listItemTerm><src></listItemTerm>
              <listItemDefinition>
                <para>The source XML file(s) containing the elements to trim.</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>
        <levelledPara>
          <title>Without namespace</title>
          <para>
            <verbatimText verbatimStyle="vs11"><section>
  <para>
    Hello world.
  </para>
</section></verbatimText>
            <verbatimText verbatimStyle="vs24">$ xml-trim -e para example.xml</verbatimText>
            <verbatimText verbatimStyle="vs11"><section>
  <para>Hello world.</para>
</section></verbatimText>
          </para>
        </levelledPara>
        <levelledPara>
          <title>With namespace</title>
          <para>
            <verbatimText verbatimStyle="vs11"><d:section>
  <d:para>
    Hello world.
  </d:para>
</d:section></verbatimText>
            <verbatimText verbatimStyle="vs24">$ xml-trim -N d=http://docbook.org/ns/docbook -e d:para example.xml</verbatimText>
            <verbatimText verbatimStyle="vs11"><d:section>
  <d:para>Hello world.</d:para>
</d:section></verbatimText>
          </para>
        </levelledPara>
        <levelledPara>
          <title>Normalizing space</title>
          <para>
            <verbatimText verbatimStyle="vs11"><section>
  <para>
    This is a <emphasis>long</emphasis>
    paragraph with both extra whitespace
    before and after the text, and line
    breaks entered by the author to wrap
    the text on a certain column.
  </para>
</section></verbatimText>
            <verbatimText verbatimStyle="vs24">$ xml-trim -n -e para example.xml</verbatimText>
            <verbatimText verbatimStyle="vs11"><section>
  <para>This is a <emphasis>long</emphasis> paragraph with both extra whitespace before
and after the text, and line breaks entered by the author to wrap the
text on a certain column.</para>
</section></verbatimText>
          </para>
        </levelledPara>
      </levelledPara>
    </description>
  </content>
</dmodule>


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