[XML-SIG] namespace/localpart tuples (was: Future plans)

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Wed, 05 Jan 2000 16:13:46 -0700


> > > I've also been thinking that we may want
> > > qualified names to be represented as tuples, either
> > > 
> > >   (namespace name (URI), localpart (element type name), prefix)
> > > 
> > > or
> > > 
> > >   (namespace name (URI), localpart (element type name))
> > 
> > I think it might be more natural to always make it a triple, and simply have 
> > '' as the third item when there is no namespace.
> 
> At processing time, the prefix that was used is irrelevant. It shouldn't
> be preserved.

The prefix has no semantic value: it is indeed syntactic sugar.  However, it 
is very important to maintain the "principle of least surprise" for users.

If a user runs his XSLT stylesheet through a SAX processor and finds that all 
his "xsl:template" elements have been renamed to "prefix00001:template", he 
might be very confused indeed.

Note that there is at least one case in which the prefix does matter: XSLT 
uses the prefix to match declared namespaces in the stylesheet to namespaces 
in the source document.  Now many people have already railed against this 
violation of the spirit of XML Namespaces 1.0, but there is no srguing that it 
was the most elegant solution to a difficult problem that the XSLT WG faced in 
dealing with namespaces.

So, in short, though prefixes are not technically part of the document, there 
are good arguments for including them in the SAX binding.

> You could end up in a situation where a client thinks that prefix "should"
> be used when regenerating XML output... the problem is that it may
> conflict (say, if you combined a couple XML docs) or not be defined in the
> (new) output (if you dropped some portion that defined the namespace).

The best solution to this is education.  If the interface documentation 
clearly states that prefixes are not technically part of the document, 
hopefully users will avoid mis-using them.  This is not ideal, but there's not 
much better to do given the practical issues involved.

> IMO, it is much better to regenerate a new set of prefixes for the set of
> namespace URIs that are present in an XML document.

Even as a user who knows better about the meaning of prefixes, I would be very 
annoyed at a processor that did this.  I often deal with documented with 4 or 
more namespaces (this is not too unusual: very common in RDF) and I give my 
prefixes mnemonic names to help sort things out.  I don't want processors 
renaming them to "p01a3", etc.


-- 
Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com	(970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com		http://OpenTechnology.org