3. validate options

Usage:

xmltool validate validate_options common_options [ xml_file ]*

Validates specified XML files. If no XML files are specified, it is the schemas specified using the "-s" option which are validated.

-s schema

Use specified schema file to validate all specified XML files.

schema must be a DTD having a ".dtd" extension or a W3C XML Schema having a ".xsd", ".xs", ".wxs" extension or a RELAX NG schema having a ".rng", ".rnc" (compact syntax) extension.

By default, the schema used for validation is found in each specified XML file (e.g. <!DOCTYPE>).

It is possible to specify several -s options:

  • When no XML files are specified, each schema is individually validated.

  • When several XML files are specified, the schemas are composed to form a compound schema (e.g. DocBook 5+MathML) and this compound schema is used to validate specified XML files.

-l

Give priority to the schemas locally specified in the file (e.g. <!DOCTYPE>) to be validated over those specified using the -s option. Ignored unless the -s option is used too.

-f

When validating a document, ignore false duplicate ID errors caused by multiple inclusions of the same element. When saving a document, replace such false duplicate IDs by automatically generated ones.

Example: Validate docbook-image.xml against the DTD specified in its <!DOCTYPE>.

/opt/xxe/demo$ xmltool validate docbook-image.xml

Example: Validate docbook-table.xml and docbook-image.xml against the DocBook 4.5 DTD.

/opt/xxe/demo$ xmltool validate -s ../addon/config/docbook/dtd/V4.5/docbookx.dtd \
    docbook-table.xml docbook-image.xml

Example: Validate the DocBook 4.5 DTD.

/opt/xxe/demo$ xmltool validate -s ../addon/config/docbook/dtd/V4.5/docbookx.dtd

Example: Validate sample.xml against the combined docbook.rng and mathml2.rng RELAX NG schemas.

/opt/xxe/addon/mathml_config/db5mml$ xmltool validate \
    -s ../../config/docbook5/rng/V5.0/docbook.rng \
    -s rng/mathml2.rng \
    sample.xml

Note that the combined schemas don't need to be of the same kind:

/opt/xxe/addon/mathml_config/db5mml$ xmltool validate \
    -s ../../config/docbook5/rng/V5.0/docbook.rng \
    -s ../standalone/xsd/mathml2.xsd \
    sample.xml