[tei-council] TEI Conformance

Conal Tuohy Conal.Tuohy at vuw.ac.nz
Tue Nov 28 08:34:09 EST 2006


James Cummings wrote:
> Ditto.  We aren't in any way saying people can't use *other* namespaces.  Just
> when they use one to create TEI extensions, that this (consensus seems to be)
> should include the letters TEI somewhere in it.

Totally agree.

Christian Wittern wrote:

> And since I see not compelling reason for going into this business, I
> think this is a bad idea.  Thus for me the compromise of having users
> define their own namespace string, but give a nod to TEI seems a good
> solution.  We could of course say *should* use the letters tei
> somewhere, not *must*. 

James:
> I was only ever going to say *should* rather than *must*.  I think a document is
> conformant if its TEI extensions don't mention the TEI, but I think it is best
> practice for them to do so.

I am totally happy with this then.

I was concerned because I'd taken the implication that customisations using those *other* namespaces would be declared non-conformant (because of e.g. not having "tei" in their namespace URIs). 

>> Right, we should think about attributes as well.  I think it should be
>> mandated to use a full qualified name if the NS of the attribute is
>> different from that one of the element, which I think is in fact
>> common practice.

> Yes, am I mistaken that attributes defaultly inherit the namespace of the
> element to which they are attached?  

I believe you are. 

<tei:element decls="#foo" xml:id="abc123" rng:something="blah"/>

> Is an element in the tei namespace (however that is defined above), and has an
> attribute tei:decls, but the local-name prefix tei: is not needed because the
> namespace is inherited from the element it is on.  This also has two attributes
> in other namespaces.

Strictly of course the namespace prefixes in your example are not bound to namespace URIs, but we can certainly guess the URIs you mean. e.g.

<tei:element xml:id="abc123" xmlns:tei="http://www.tei-c.org/ns/1.0" decls="#foo"/>

This is an element which has a "qualified name" of "tei:element". But this is just shorthand for its "expanded name" which is a combination of its "namespace name", which is "http://www.tei-c.org/ns/1.0" (not "tei", which is just the shorthand prefix), and its "local name", which is "element". The element has 2 attributes, one has a name in the "xml" namespace and the other (decls) is in NO namespace, or to put it another way, the decls attribute's namespace has the name "". That decls attribute is not in the TEI namespace, that is, the namespace formally known as "http://www.tei-c.org/ns/1.0"

See http://www.w3.org/TR/REC-xml-names/#defaulting for details of namespace "inheriting". 

When the "tei" prefix is "bound" to the uri "http://www.tei-c.org/ns/1.0", that prefix may then be used  anywhere within that element (as an alias for "http://www.tei-c.org/ns/1.0"). So the "binding" between the prefix and the URI is inherited by child elements. 

However, child elements are not automatically in the same namespace as their parent - they must actually use the prefix in order to belong to the same namespace. In the example the "tei" which is bound to a prefix (such as the "tei:" prefix in your example) is not inherited by either child elements or attributes.

With "default" namespaces it's slightly different. 

As an alternative to using a namespace prefix like "tei:", a namespace may be declared as the "default" namespace using the "xmlns" attribute, like so:

<element xml:id="abc123" xmlns="http://www.tei-c.org/ns/1.0" decls="#foo"/>

NB this is semantically identical to the earlier example. 

This is essentially equivalent to binding the namespace URI to the empty prefix. Any unprefixed elements then are interpreted as being in the default namespace.

"Default" namespaces apply to the element on which they are declared and all its child elements. However default namespaces do not apply to attributes, only to elements. Hence the only attributes with defined namespaces are those which have explicit namespace prefixes. That's why, to correctly interpret the meaning of an attribute without a namespace prefix, you have to know the (qualified) name of the element which contains it. 

> Am I mistaken about that? It shouldn't be tei:decls="#foo" should it?!

If we wanted to put all TEI-defined attributes in the TEI P5 namespace, yes we would have to write it like that. But I don't think we really want that do we? :-)


Cheers

Con



More information about the tei-council mailing list