Blob Blame History Raw
<?xml version="1.0"?>
<!-- vim: sw=2 sta et
-->


<!DOCTYPE refentry
  PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [

  <!ENTITY nsgmls1 "
    <citerefentry>
      <refentrytitle><command>nsgmls</command></refentrytitle>
      <manvolnum>1</manvolnum>
    </citerefentry>">
]>

<refentry>
  <refentryinfo>
    <date>05 July 1999</date>
  </refentryinfo>

  <refmeta>
    <refentrytitle>sgml2xml</refentrytitle>
    <manvolnum>1</manvolnum>
    <refmiscinfo>SP</refmiscinfo>
  </refmeta>
  
  <refnamediv>
    <refname>sgml2xml</refname>
    <refpurpose>convert SGML to XML</refpurpose>
    <refclass>
      An SGML System Conforming to International Standard ISO 8879 &mdash;
      Standard Generalized Markup Language
    </refclass>
  </refnamediv>
  
  <refsynopsisdiv>
    <cmdsynopsis>
      <command>sgml2xml</command>
      <arg choice="opt" rep="norepeat"><option>-Cehilprvx</option></arg>
      <arg choice="opt" rep="norepeat"><option>-b<replaceable>encoding</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-c<replaceable>catalog</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-D<replaceable>dir</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-f<replaceable>file</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-i<replaceable>name</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-w<replaceable>warning</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-x<replaceable>xml-output-option</replaceable></option></arg>
      <arg choice="req" rep="repeat"><replaceable >sysid</replaceable></arg>
    </cmdsynopsis>
  </refsynopsisdiv>
  
  <refsect1>
    <title>Description</title>
    
    <para>
      <command>sgml2xml</command> converts <acronym>SGML</acronym> to 
      <acronym>XML</acronym>. <command>sgml2xml</command> parses and validates
      the SGML document contained in <replaceable>sysid...</replaceable> and 
      writes an equivalent XML document to the standard output.  <command>
      sgml2xml</command> will warn about SGML constructs which have no XML 
      equivalent.
    </para>
  </refsect1>
  
  <refsect1>
    <title>Options</title>
    
    <variablelist>
      <varlistentry>
        <term><option>-b<replaceable>encoding</replaceable></option></term>
        <listitem>
          <para>
            Use <replaceable>encoding</replaceable> for output.  
            The default is UTF-8.  See &nsgmls1; for the possible encoding 
            types.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-c<replaceable>catalog</replaceable></option></term>
        <listitem>
          <para>
            Use the catalog entry file <replaceable>file</replaceable>.  
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-C</option></term>
        <listitem>
          <para>
            The <replaceable>filename...</replaceable> arguments specify 
            catalog files rather than the document entity. The document entity
            is specified by the first <sgmltag>DOCUMENT</sgmltag> entry in the
            catalog files.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-D<replaceable>directory</replaceable></option></term>
        <listitem>
          <para>
            Search <replaceable>directory</replaceable> for files specified in
            system identifiers.  Multiple <option>-D</option> options are 
            allowed.  See &nsgmls1; for more information about this option.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-e</option></term>
        <listitem>
          <para>Describe open entities in error messages.</para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-f<replaceable>file</replaceable></option></term>
        <listitem>
          <para>
            Redirect errors to <replaceable>file</replaceable>. 
            This is useful only for shells that do not support redirection 
            of stderr.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-i<replaceable>name</replaceable></option></term>
        <listitem>
          <para>
            Pretend that <literal>&lt;!ENTITY % <replaceable>name</replaceable> "INCLUDE"&gt;</literal>

            occurs at the start of the document type declaration subset
            in the SGML document entity. Since repeated definitions of
            an entity are ignored, this definition will take precedence
            over any other definitions of this entity in the document
            type declaration. Multiple <option>-i</option> options are
            allowed.  If the SGML declaration replaces the reserved name
            <sgmltag>INCLUDE</sgmltag> then the new reserved name will
            be the replacement text of the entity.  Typically the
            document type declaration will contain
          
            <literal>&lt;!ENTITY % <replaceable>name</replaceable> "IGNORE"&gt;</literal>
            and will use <sgmltag>%<replaceable>name</replaceable>;</sgmltag>
            
            in the status keyword specification of a marked section
            declaration. In this case the effect of the option will be
            to cause the marked section not to be ignored.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-v</option></term>
        <listitem>
          <para>Print the version number.</para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-w<replaceable>type</replaceable></option></term>
        <listitem>
          <para>
            Control warnings and errors according to 
            <replaceable>type</replaceable>.  See &nsgmls1;
            for the allowed values of <replaceable>type</replaceable>.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>-x<replaceable>xml-output-option</replaceable></option></term>
        <listitem>
          <para>
            Control the XML output, according to the value of
            <replaceable>xml_output_option</replaceable> as follows:

            <variablelist>
              <varlistentry>
                <term><literal>no-nl-in-tag</literal></term>
                <listitem>
                  <para>
                    Don't use newlines inside start-tags. Usually 
                    <command>sgml2xml</command> uses newlines inside 
                    start-tags so as to reduce the probability of
                    excessively long lines.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>id</literal></term>
                <listitem>
                  <para>
                    Output attribute declarations for <sgmltag>ID</sgmltag>
                    attributes. 
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>notation</literal></term>
                <listitem>
                  <para>Output declarations for notations.</para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>ndata</literal></term>
                <listitem>
                  <para>
                    Output declarations for external data entities. XML 
                    requires these to be <sgmltag>NDATA</sgmltag>. 
                    <command>sgml2xml</command> will warn about 
                    <sgmltag>CDATA</sgmltag> and <sgmltag>SDATA</sgmltag> 
                    external data entities and output them as NDATA entities.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>cdata</literal></term>
                <listitem>
                  <para>
                    Use XML <sgmltag>CDATA</sgmltag> sections for 
                    <sgmltag>CDATA</sgmltag> marked sections and for elements
                    with a declared content of <sgmltag>CDATA</sgmltag>.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>comment</literal></term>
                <listitem>
                  <para>
                    Output comment declarations. Comment declarations in
                    the DTD will not be output.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>lower</literal></term>
                <listitem>
                  <para>
                    Prefer lower case. Names that were subjected to
                    upper-case substitution by SGML will be folded to
                    lower case. This does not include reserved names;
                    XML requires these to be in upper-case.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><literal>pi-escape</literal></term>
                <listitem>
                  <para>
                    Escape <literal>&amp;&lt;&gt;</literal> in the contents 
                    of processing instructions using the 
                    <sgmltag>amp</sgmltag>, <sgmltag>lt</sgmltag> and
                    <sgmltag>gt</sgmltag> entities.  This allows processing 
                    instructions to contain the string 
                    <literal>&gt;?</literal>, but requires that applications 
                    handle the escapes.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>empty</literal></term>
                <listitem>
                  <para>
                    Use the <markup>&lt;<replaceable>e</replaceable>/&gt;</markup> 
                    syntax for element types <replaceable>e</replaceable> 
                    declared as <sgmltag>EMPTY</sgmltag>.
                  </para>
                </listitem>
              </varlistentry>
              
              <varlistentry>
                <term><literal>attlist</literal></term>
                <listitem>
                  <para>
                    Output a <sgmltag>ATTLIST</sgmltag> declaration for
                    every element specifying the type of all attributes.
                    The default will always be <sgmltag>#IMPLIED</sgmltag>.
                  </para>
                </listitem>
              </varlistentry>
            </variablelist>
          
            Multiple <option>-x</option> options are allowed.
          </para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
  
  <refsect1>
    <title>Author</title>
    <simpara>James Clark <email>jjc@jclark.com</email></simpara>
  </refsect1>
  
  <refsect1>
    <title>See Also</title>
    
    <simplelist type="vert">
      <member>&nsgmls1;</member>
      <member><filename>/usr/share/doc/sp/sx.htm</filename></member>
    </simplelist>
  </refsect1>
</refentry>