Next / Previous / Contents / TCC Help System / NM Tech homepage

4.2. Type identifiers and how they work

If you are writing a general-purpose schema locating file, type identifiers declared using typeId rules can be most useful.

Here's an example. Suppose you want all files ending in .html, and all files that use the XHTML namespace URI, to use the XHTML Strict schema. You could use <uri pattern="*.html" xhtml-strict.rnc/> and namespace rules that refer directly to the XHTML Strict schema. However, consider this fragment of a schema locating file:

    <uri pattern="*.html" typeId="XHTML" />
    <namespace ns=""
               typeId="XHTML" />
    <typeId id="XHTML" typeId="XHTML Strict"/>
    <typeId id="XHTML Strict"
    <typeId id="XHTML Transitional"

The first rule associates all files ending in .html with type ID "XHTML".

The second rule associates all files with default namespace "" with type ID "XHTML".

The third rule defines type ID "XHTML" as the equivalent of another type ID "XHTML Strict".

The last two rules relates type IDs "XHTML Strict" and "XHTML Transitional" to specific schema files.

The advantage to this indirect linking of rules to schema is that, if you want to, you can change from XHTML Strict to XHTML Transitional by changing the third line to:

    <typeId id="XHTML" typeId="XHTML Transitional"/>