19. relaxng
Prev | Chapter 7. Configuration elements | Next

## 19. relaxng

    <relaxng
      location = anyURI
      name = non empty token
      compactSyntax = boolean
      encoding = any encoding supported by Java™
    />

Use the RELAX NG schema specified by this element to constrain the document.

location

  Required. Specifies the URL of the RELAX NG schema.

name

  A unique name for the RELAX NG schema (similar to the public ID of a DTD). Without such name, a RELAX NG schema cannot be cached.

  When possible, the ``target namespace'' of the RELAX NG schema is a sensible choice for this attribute.

compactSyntax

  Specifies that the RELAX NG schema is written using the compact syntax. Without this attribute, if `location` has a "`rnc`" extension, the schema is assumed to use the compact syntax, otherwise it is assumed to use the XML syntax.

encoding

  Specifies the character encoding used for a RELAX NG schema written using the compact syntax. Ignored if the XML syntax is used. Without this attribute, the schema is assumed to use the native encoding of the platform.

Note that

- if a document contains a document type declaration (<!DOCTYPE>) which defines elements,

- or if the root element of a document has `xsi:schemaLocation`/`xsi:noNamespaceSchemaLocation` attributes,

- of if a document contains a <?xxe-relaxng-schema location="..."?> processing instruction,

the grammar specified this way is used and the RELAX NG schema specified in the configuration file is ignored.

XHTML RELAX NG example:

    <relaxng name="http://www.w3.org/1999/xhtml"
             location="rng/xhtml-strict.rng" />

Compact syntax example:

    <relaxng compactSyntax="true" encoding="ISO-8859-1"
             location="example3.rnc"
             name="http://www.xmlmind.com/xmleditor/schema/example3"/>

It possible to use both a `relaxng` configuration element and a dtd configuration element but in this case, the `dtd` configuration element cannot be used to specify a content model. It may be used to specify a set of character entities.

Prev | Up | Next
18. preserveSpace | Home | 20. saveOptions