Author: Lars Marius Garshol
Description: This page documents the command-line interface of xmlproc.
Keywords: XML, Python, XML parser

# Using xmlproc from the command-line

The command-line parser is in xpcmd.py for well-formedness parsing and xvcmd.py for validating parsing.

## xpcmd.py

xpcmd.py is a command-line interface to the parser. It continues parsing after even fatal errors, in order to be find more errors, since this does not mean feeding data to the application after a fatal error (which would be in violation of the spec).

    Usage:

      xpcmd.py [options] [urltodoc]

      ---Options:
      -l language: ISO 3166 language code for language to use in error messages
      -o format:   Format to output parsed XML. 'e': ESIS, 'x': canonical XML
                   and 'n': normalized XML. No data will be output if this
                   option is not specified.
      urltodoc:    URL to the document to parse. (You can use plain file names
                   as well.) Can be omitted if a catalog is specified and contains
                   a DOCUMENT entry.
      -n:          Report qualified names as 'URI name'. (Namespace processing.)
      --nowarn:    Don't write warnings to console.
      --entstck:   Show entity stack on errors.
      --extsub:    Read the external subset of documents.

## xvcmd.py

xvcmd.py validates and has more options:

    Usage:

      xvcmd.py [options] [urlstodocs]

      ---Options:
      -c catalog:   path to catalog file to use to resolve public identifiers
      -l language:  ISO 3166 language code for language to use in error messages
      -o format:    Format to output parsed XML. 'e': ESIS, 'x': canonical XML
                    and 'n': normalized XML. No data will be output if this
                    option is not specified.
      urlstodocs:   URLs to the documents to parse. (You can use plain file names
                    as well.) Can be omitted if a catalog is specified and contains
                    a DOCUMENT entry.
      -n:           Report qualified names as 'URI name'. (Namespace processing.)
      --nowarn:     Suppress warnings.
      --entstck:    Show entity stack on errors.
      --rawxml:     Show raw XML string where error occurred.

      Catalog files with URLs that end in '.xml' are assumed to be XCatalogs,
      all others are assumed to be SGML Open Catalogs.

      If the -c option is not specified the environment variables XMLXCATALOG
      and XMLSOCATALOG will be used (in that order).