Contents
Index
Search

25. relaxng

<relaxng
  location = anyURI
  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.

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 <?xml-model href="..."?>,

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

Example:

<relaxng location="rng/xhtml-strict.rng" />

Compact syntax example:

<relaxng compactSyntax="true" encoding="ISO-8859-1" 
         location="example3.rnc" />