A.4. HXmlParser - Well-formedness checker and validator

The Haskell XML Toolbox comes with a command line tool for checking if XML documents are well-formed and valid. To build this tool with GHC, run make HXmlParser in the root directory of the Haskell XML Toolbox. This will produce the binary file HXmlParser that will be stored in the root directory. The sources of this tool are located in the directory examples.

When checking an invalid XML file, HXmlParser will report errors to stderr and quit with an exit code of "-1". If there are no errors in the document, the tool will just quit without any message.

If you run HXmlParser without any arguments, the usage information is displayed:


Usage:
  --source "filename"  - source file (required)
  --encoding "charset" - document encoding
  --trace "level"      - trace level (0-4)

  -h                   - this help
  -v                   - display a message if document is well-formed or valid
  -w                   - well-formed check only

  -op                  - output parsed document
  -opt                 - output XmlTree of parsed document
  -oph                 - output Haskell type of parsed document

Only for validity checks:
  -ot                  - output transformed document
  -ott                 - output XmlTree of transformed document
  -oth                 - output Haskell type of transformed document

  -oc                  - output canonicalized document
  -oct                 - output XmlTree of canonicalized document
  -och                 - output Haskell type of canonicalized document