[tei-council] Tite namespace primer
David Sewell
dsewell at virginia.edu
Thu Jul 9 21:29:14 EDT 2009
The confusion over namespaces and the convenience elements suggests that
at some point we are going to need to present a version of the following
information in a prominent way for users of TEI Tite. The current
Recommendations document (at
http://www.tei-c.org/release/doc/tei-p5-exemplars/html/tei_tite.doc.html#typographical)
doesn't make this clear.
========
The TEI Tite "convenience elements" are in a non-TEI namespace,
http://www.tei-c.org/ns/tite/1.0.
There are three different ways of keying those elements so that the
resulting Tite XML document is valid.
1. Put an explicit namespace on the element:
<text xmlns="http://www.tei-c.org/ns/1.0">
<body>
<p>This is a <i xmlns="http://www.tei-c.org/ns/tite/1.0">valid</i>
TEI Tite document.</p>
</body>
</text>
2. Declare a namespace prefix and use it with the element:
<text xmlns="http://www.tei-c.org/ns/1.0"
xmlns:t="http://www.tei-c.org/ns/tite/1.0">
<body>
<p>This is a <t:i>valid</t:i> TEI Tite document.</p>
</body>
</text>
Methods 1 and 2 will work to validate against a RELAX NG schema (by
itself) or a W3C Schema (by itself)
3A. Reference the TEI Tite DTD within the Tite document:
<!DOCTYPE text SYSTEM "http://www.tei-c.org/release/xml/tei/custom/schema/dtd/tei_tite.dtd">
<text xmlns="http://www.tei-c.org/ns/1.0">
<body>
<p>This is a <i>valid</i> Tite document.</p>
</body>
</text>
The reason why method 3 works is that the DTD contains statements such
as
<!ATTLIST i xmlns CDATA "http://www.tei-c.org/ns/tite/1.0">
which an XML parser uses to assign a namespace to the <i> element. In
fact an internal DTD subset can also be used without reference to the
full DTD:
3B. Include a DTD subset assigning the correct namespace attributes to
the convenience elements:
<!DOCTYPE text [
<!ATTLIST i xmlns CDATA "http://www.tei-c.org/ns/tite/1.0">
]>
<text xmlns="http://www.tei-c.org/ns/1.0">
<body>
<p>This is a <i>valid</i> Tite document.</p>
</body>
</text>
When the latter document is parsed by an XML parser, it is assigned the
correct namespace, and will thus validate against a RELAX NG or W3C
Schema as well.
--
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 801079, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell at virginia.edu Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
More information about the tei-council
mailing list