Root Namespaces, 'document types' and XPaths

A couple of points after reading the IRC chatlogs of 2/12

The status of the root element namespace was discussed. Essentially whether
a document type is primarily specified by the root element namespace. XSLT
is seen as a problem case. RDDL is actually another problem case because a
RDDL document is _designed_ to be machine readable even though the root
element namespace is http://www.w3.org/1999/xhtml

There are two ways of looking at document types which solve this problem:

First, view the _set_ of root element namespace declarations as a _set_ of
type specifiers.

That is to say: every XHTML document which contains a (root) RDDL namespace
decl is _intended_ to be machine processable ... perhaps the RDDL spec needs
to say this more explicitly.

1:1 'type' <-> document binding doesn't work well particularly in the
general case, and while the root element namespace gets us part way there,
the set of namespaces is much better.

Secondly, XML Schema divorces the XML 1.0 equation of element type and
element name (the root element namespace is an important part of its nme).
XML Schema has both global and local types. While the root element _seems_
to be in a global position, the descendents of an element affect the element
type.

The XML Schema formalism WD contains a section whose title includes the term
"normalization". The idea is that a type name can be "flattened" into
something that looks like a path.

Applying the idea of path as type, the _type_ of an XSLT document,
generally:

/*//xslt:*

or in english, this pattern matches documents which contain an element
qualified by the XSLT namespace regardless of depth.

Similarly for RDDL:

/xhtml:html/xhtml:body//rddl:resource

Matches an XHTML document which contains an embedded RDDL resource within
the body.

The root element namespace is a special case XPath:

/foo:*

The big advantage is that a streaming XML processor is given the namespace
URI just at the start of document processing, which is the most efficient
point. However, such architectural questions should not be answered on
efficiency grounds alone, and using an XPath as a document type specifier is
more general, and hence better (IMHO). Moreover the set of namespace decls
is generally given to a processor before element processing (e.g. SAX),
hence using the root element qualifying namespace is no more efficient than
using any other namespace declared on the root element.

Jonathan

Received on Monday, 18 February 2002 10:04:22 UTC