5. Rngvalid command reference
Prev |  | Next

## 5. Rngvalid command reference

rngvalid ?validate_options? `relax_ng_schema` ?gen_doc_options? ?`xml_doc` ... `xml_doc`?

Checks a RELAX NG schema (supports both XML and compact syntax) for validity. Checks one or more XML documents for validity against a RELAX NG schema.

Note that the `<?xxe-relaxng-schema>` processing instruction is not supported by rngvalid. Therefore, even when `foo.xml` contains such processing instruction, it is not possible to simply execute "`rngvalid foo.xml`".

This command is based on Jing, an OpenSource, industrial strength, streaming validator written by James Clark. The implementation of W3C XML Schema Datatypes used in RELAX NG schemas (e.g. `xsd:int`) is the work of XMLmind. XMLmind also added support for attribute default values as specified in RELAX NG DTD Compatibility.

Validation options:

-v

  Be verbose. Default: be quiet.

-c

  Specifies that relax_ng_schema uses the compact syntax.

  Default: if file suffix is '`.rnc`' assume compact syntax otherwise assume XML syntax.

-e `rnc_charset`

  Specifies the character encoding of the schema using the compact syntax.

  Default: platform default encoding.

Options of the documentation generator:

-gendoc `doc_dir`

  Generate documentation in directory `doc_dir`.

  Default: do not generate documentation.

-css `CSS_URL`

  Specifies which CSS style sheet to use in the generated HTML.

  Default: no CSS.

-charset `html_charset`

  Specifies the character encoding of the generated HTML.

  Default: platform default encoding.

-xxe

  Add annotations which are useful when the RELAX NG schema is used by XMLmind XML Editor.

  Default: don't annotate.

This command is XML catalog aware. This command will use the XML catalogs specified in environment variable `XML_CATALOG_FILES`. This variable must contain one or several XML catalog file names or URLs separated by a semi-colon ('`;`').

XML catalogs may be used to resolve URLs found in `include` and `externalRef` elements. Note that the equivalent notations in the compact syntax are not XML catalog aware.

Examples:

- Validate schema `bugreport.rnc`:

      $ rngvalid bugreport.rnc

- Validate schema `xhtml-strict.rnc`, explicitly specifying its encoding and that the compact syntax is being used:

      $ rngvalid -e ISO-8859-1 -c bugreport.rnc

- Validate `sample.xhtml` and `bad.xhtml` against `bugreport.rnc` (verbosity turned on):

      $ rngvalid -v bugreport.rnc sample.xml bad.xml
      Loading RELAX NG schema 'bugreport.rnc'...1177ms.
      sample.xml
      ----------
      Loading document 'sample.xml'...166ms.
      Validating 'sample.xml' against 'bugreport.rnc'...99ms.
      bad.xml
      -------
      Loading document 'bad.xml'...8ms.
      Validating 'bad.xml' against 'bugreport.rnc'...71ms.
      bad.xml:E:9:5:
      bad character content for element
      bad.xml:E:12:7:
      unknown element "windows98" from namespace
      "http://www.xmlmind.com/xmleditor/schema/bugreport"
      bad.xml:E:11:5:
      unfinished element
      bad.xml:E:19:5:
      bad character content for element
      bad.xml:E:24:9:
      unknown element "font" from namespace
      "http://www.w3.org/1999/xhtml"
      bad.xml:E:48:9:
      attribute "align" not allowed at this point; ignored

- Generate documentation for `bugreport.rnc` in directory `/tmp/`:

      $ rngvalid bugreport.rnc -gendoc /tmp

Prev |  | Next
4. Dtdvalid command reference | Home | 6. Schvalid command reference