Here is a list of the rules that can appear in a schema locating file:
<uri resource="f" uri="s"/>
Associate resource
with schema file
f.
The resource may be a full URI or a local file
name.
s
For example, this rule would associate file
abc.xyz with schema
xyz.rnc:
<uri resource="abc.xyz" uri="xyz.rnc"/>
<uri pattern="p" uri="s"/>
Like the previous form, but may contain one or more
wild-card characters “p*”.
For example, this rule would associate all files
ending in .xyz with schema
xyz.rnc:
<uri pattern="*.xyz" uri="xyz.rnc"/>
<uri pattern="p" typeId="T"/>
A rule of this form associates any URI matching
pattern with type identifier p. See Section 4.2, “Type identifiers and how they work”.
T
<documentElement
prefix="N"
localName="E"
uri="s"/>
If a document's root element is
in namespace
E,
use schema file
N.
s
If you omit the namespace identifier
prefix=",
this rule matches by document element regardless of
the namespace.
N"
If you omit the element name
prefix=",
this rule will match all root elements in namespace
E", if
given. If both Nprefix and
localName attribute are omitted, it
matches all documents. Example:
<documentElement localName="horses" uri="horse.rnc"/>
This will associate any file whose
root element is horses with
schema file horse.rnc.
<documentElement
prefix="N"
localName="E"
typeId="T"/>
Like the preceding form, but it associates the
matching files with type identifier ; see Section 4.2, “Type identifiers and how they work”. Examples:
T
<documentElement localName="stylesheet" typeId="XSLT"/> <documentElement prefix="xsl" localName="transform" typeId="XSLT"/>
The first example will associate any file whose
root element is stylesheet with type
XSLT. The second example associates
any file whose root element is xsl:transform with that same type code.
<transformURI
fromPattern="p"
toPattern="q"/>
If a file has a name of the form
“”, try to match a schema file whose
name is “p”. The patterns may contain one or
more q* characters. For each * in pattern , the text
that matches the p* will be
substituted for the corresponding *
in pattern .
q
Here's an example. The following rule means that
for any file ending in “.xml”, if there is a schema by the same name
ending with “.rnc”,
use that schema.
<transformURI fromPattern="*.xml" toPattern="*.rnc"/>
So for example if you have a file named
“horses.xml” and a
schema file “horses.rnc”, the above locating rule would associate
them.
<namespace
ns="N"
uri="s"/>
If the file's root element has the same namespace URI as
, use schema
N.
s
<namespace
ns="N"
typeId="T"/>
Like the previous form, but files in namespace
will
be associated with type id N.
T
<typeId
id="T"
uri="s"/>
Defines a new type ID
,
and says to use schema
T
for rules that refer to that type ID.
A type ID name is an arbitrary string you make up to
describe a document type (schema).
s
In any of the rules that have a
uri="
attribute, you can instead use a
s"typeId="
attribute. Assuming you have defined the type ID
T",
the rule will use the schema related to that type
ID.
T
<typeId
id="T"
typeId="U"/>
Defines a type ID named
as the same as type ID
T.
U
<include
rules="F"/>
Includes another schema locating file
.
F
<applyFollowingRules
ruleType="R"/>
This rule instructs
emacs to immediately
search all the remaining schema locating files in
its list (the value of its
rng-schema-locating-files
variable), and apply all rules of type
.
R
For example, suppose you want to use the transform
rewrite rules of type <transformURI> that are in
the files after this one in the sequence of schema
locating files. You can't just use the <include> rule, because if
any rule in the later files matches, it will win.
So instead you use this rule:
<applyFollowingRules ruleType="transformURI"/>
If emacs gets to this
rule without a match, it will then go and apply all
the transformURI
rules from later files, using them to rewrite the
pathname if appropriate. Then matching continues
in the current file, using the rewritten pathname.