Node:Using type identifiers in schema locating files, Next:Using multiple schema locating files, Previous:Using the document element to locate a schema, Up:Schema locating files
Type identifiers allow a level of indirection in locating the
schema for a document. Instead of associating the document directly
with a schema URI, the document is associated with a type identifier,
which is in turn associated with a schema URI. nXML mode does not
constrain the format of type identifiers. They can be simply strings
without any formal structure or they can be public identifiers or
URIs. Note that these type identifiers have nothing to do with the
DOCTYPE declaration. When comparing type identifiers, whitespace is
normalized in the same way as with the xsd:token
datatype: leading and trailing whitespace is stripped; other sequences
of whitespace are normalized to a single space character.
Each of the rules described in previous sections that uses a
uri
attribute to specify a schema, can instead use a
typeId
attribute to specify a type identifier. The type
identifier can be associated with a URI using a typeId
element. For example,
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"> <namespace ns="http://www.w3.org/1999/xhtml" typeId="XHTML"/> <typeId id="XHTML" typeId="XHTML Strict"/> <typeId id="XHTML Strict" uri="xhtml-strict.rnc"/> <typeId id="XHTML Transitional" uri="xhtml-transitional.rnc"/> </locatingRules>
declares three type identifiers XHTML
(representing the
default variant of XHTML to be used), XHTML Strict
and
XHTML Transitional
. Such a schema locating file would
use xhtml-strict.rnc
for a document whose namespace is
http://www.w3.org/1999/xhtml
. But it is considerably
more flexible than a schema locating file that simply specified
<namespace ns="http://www.w3.org/1999/xhtml" uri="xhtml-strict.rnc"/>
A user can easily use C-c C-t to select between XHTML
Strict and XHTML Transitional. Also, a user can easily add a catalog
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"> <typeId id="XHTML" typeId="XHTML Transitional"/> </locatingRules>
that makes the default variant of XHTML be XHTML Transitional.