33. validate

<validate
  namespace = non empty anyURI
>
  Content: dtd|schema|relaxng
</validate>

Dynamically compose the auxiliary schema specified in this element with the main schema specified in the document itself (e.g. <!DOCTYPE>) or, in absence of such specification, with the main schema specified using the DTD, schema or relaxng configuration element.

More precisely, this element means: whenever you find an XML subtree having a root element belonging to the namespace specified using the namespace attribute, use specified schema rather than the content model specified in the main schema.

This facility is meant to be used to validate ``alien subtrees'', for example SVG or MathML subtrees found in XHTML, DocBook or DITA documents. A well-designed main schema generally specifies a very loose content model for such alien elements. Example: <!ELEMENT mml:math ANY>.

It is possible to compose schema of different kinds. For example, it is possible to compose the main DITA DTD with a RELAX NG auxiliary schema.

It is possible to specify several validate configuration elements, each element having of course a different namespace attribute.

Example: Validate XML subtree having a root element belonging to the "http://www.w3.org/1998/Math/MathML" namespace using the "rng/mathml2.rng" RELAX NG schema.

  <validate namespace="http://www.w3.org/1998/Math/MathML">
    <relaxng location="rng/mathml2.rng" />
  </validate>