24. schema
Prev | Chapter 7. Configuration elements | Next

## 24. schema

    <schema>
      Content: location | noNamespaceLocation | (location noNamespaceLocation)
    </schema>

    <location>
      Content: list of anyURI pairs
    </location>

    <noNamespaceLocation>
      Content: anyURI
    </noNamespaceLocation>

Use the W3C XML Schema specified by this element to constrain the document.

The content of child element `location` is identical to the one of standard attribute `xsi:schemaLocation`. The content of child element `noNamespaceLocation` is identical to the one of standard attribute `xsi:noNamespaceSchemaLocation`.

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 W3C XML Schema specified in the configuration file is ignored.

Example:

    <schema>
      <location>http://www.w3.org/1999/xhtml
                xsd/5.0/xhtml5.xsd</location>
    </schema>

### Validating W3C XML Schemas

If your configuration allows to edit W3C XML Schemas, you'll typically specify:

    <schema>
      <location>http://www.w3.org/2001/XMLSchema
                xsd/XMLSchema.xsd</location>
    </schema>

where `xsd/XMLSchema.xsd` is a copy of the XML Schema for XML Schemas.

However, it is also possible to validate the document being edited using XXE's built-in schema validator. This kind of validation is more comprehensive than the one performed by the XML Schema for XML Schema alone. This is achieved by referencing the "`xxe-schema-for-schema`" dummy URI:

    <schema>
      <location>http://www.w3.org/2001/XMLSchema
                xxe-schema-for-schema</location>
    </schema>

Prev | Up | Next
23. saveOptions | Home | 25. schematron