6. Schvalid command reference
Prev |  | Next

## 6. Schvalid command reference

schvalid ?`-v`? ?`-iso`? ?`-nons`? `schema` ?`-write` `out_schema`? ?`-phase` `phase_id`? ?`-var` `name` `value` ... `-var` `name` `value`? ?`xml_doc` ... `xml_doc`?

Validate specified XML documents against specified Schematron schema. Optionally validate the schema as an ISO Schematron.

This command supports both ISO Schematron and Schematron 1.5. It cannot validate a Schematron 1.5 schema. However it can load a Schematron 1.5 schema and use it for instance validation.

Unless the `-iso` option, which forces schema validation, is used, the schematron (ISO or 1.5) may be embedded in another type of XML document (e.g. a DocBook 5 RELAX NG grammar, but not using the compact syntax).

Options:

-v

  Turns verbosity on.

-iso

  Fully validate `schema` as being an ISO Schematron schema.

  Default: do not validate `schema`. Just load it.

  Note that, unless this schema validation option is turned on, the Schematron loader is very lenient and accepts ISO Schematron as well as Schematron 1.5 schemas.

-nons

  When loading the schema, accept unknown namespace prefixes. That is, interpret `foo:bar` as being `{}foo:bar` and not as being `{unknown_namespace}bar`.

  This may be needed for documents conforming to a DTD because in such case, the document is not namespace aware.

-write `out_schema`

  Write loaded `schema` to specified file. The written schema is in all cases an ISO Schematron schema using the minimal syntax.

-phase `phase_id`

  Specifies the ID of the phase which is to be used for validation. May also be `#ALL` or `#DEFAULT`.

  Default: `#DEFAULT`, if any, `#ALL` otherwise.

-var `name` `value`

  Specify overrides for some of the `let` variables defined in the schematron.

  Note that `value` must be a valid XPath expression and not a plain string (e.g. "`'Hello world'`" and not just "`Hello world`").

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 `sch:include` elements.

Examples:

- Fully validate schematron `xhtml.sch`:

      $ schvalid -iso xhtml.sch

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

      $ schvalid -v xhtml.sch sample.xhtml bad.xhtml
      Loading schema 'xhtml.sch'...565ms.
      sample.xhtml
      ------------
      Loading document 'sample.xhtml'...50ms.
      Validating document 'sample.xhtml' against 'xhtml.sch'...13ms.
      bad.xhtml
      ---------
      Loading document 'bad.xhtml'...4ms.
      Validating document 'bad.xhtml' against 'xhtml.sch'...2ms.
      bad.xhtml:E:2:1:
      The primary language of a document should be identified.
      bad.xhtml:E:8:20:
      Concerning element xhtml:b: b and i are not recommended.
      Use strong and em, or stylesheets.
      bad.xhtml:E:8:33:
      Concerning element xhtml:i: b and i are not recommended.
      Use strong and em, or stylesheets.
      bad.xhtml:E:10:5:
      A table should have a caption
      bad.xhtml:E:10:5:
      A table should have a summary attribute

- Validate `bad.xhtml` against `xhtml.sch` using phase `minimal`:

      $ schvalid xhtml.sch -phase minimal bad.xhtml
      bad.xhtml:E:8:20:
      Concerning element xhtml:b: b and i are not recommended.
      Use strong and em, or stylesheets.
      bad.xhtml:E:8:33:
      Concerning element xhtml:i: b and i are not recommended.
      Use strong and em, or stylesheets.

Prev |  | Next
5. Rngvalid command reference | Home | 7. Implementation limits