Next: , Up: Schema locating files

6.2.1 Schema locating file syntax basics

There is a schema for schema locating files in the file ‘locate.rnc’ in the schema directory. Schema locating files must be valid with respect to this schema.

The document element of a schema locating file must be ‘locatingRules’ and the namespace URI must be ‘’. The children of the document element specify rules. The order of the children is the same as the order of the rules. Here's a complete example of a schema locating file:

     <?xml version="1.0"?>
     <locatingRules xmlns="">
       <namespace ns="" uri="xhtml.rnc"/>
       <documentElement localName="book" uri="docbook.rnc"/>

This says to use the schema ‘xhtml.rnc’ for a document with namespace ‘’, and to use the schema ‘docbook.rnc’ for a document whose local name is ‘book’. If the document element had both a namespace URI of ‘’ and a local name of ‘book’, then the matching rule that comes first will be used and so the schema ‘xhtml.rnc’ would be used. There is no precedence between different types of rule; the first matching rule of any type is used.

As usual with XML-related technologies, resources are identified by URIs. The ‘uri’ attribute identifies the schema by specifying the URI. The URI may be relative. If so, it is resolved relative to the URI of the schema locating file that contains attribute. This means that if the value of ‘uri’ attribute does not contain a ‘/’, then it will refer to a filename in the same directory as the schema locating file.