[XML-SIG] SAX Namespaces

Uche Ogbuji uogbuji@fourthought.com
Tue, 04 Jul 2000 00:29:24 -0600


> > > Paul Prescod:

> > > > The rawname *is* the element type name.

> > Greg Stein:

> > > No, the element name is the (namespace, element-name) tuple. 

> > > Paul Prescod:

> > You won't find that in any XML specification.

> > Greg Stein:

> The XML Namespaces spec states that the URI and the localname form the
> complete, unique element name.

I think we have a case of duelling specs here.  What exactly Namespaces 1.0 
(XML/NS) is up to has been the subject of many a flame war that I hope we 
don't have to rehash.

If I read Paul correctly, he carefully used the term "element type name", 
which is a high quiddity of XML (and SGML before it) that I don't think XML/NS 
tries to muck with.  It seems to me from reading XML/NS that they are most 
concerned with disambiguating *generic identifiers*, which are, arguably, what 
most programmers expect to be dealing with when they plug into SAX.

At any rate, all the data is available in both approaches, so does it really 
matter?

> > Namespace are nasty long before you get to an API. You don't even need
> > to be sitting at a computer. Just read the spec! By the way, qp_xml's
> > handling of the xml: namespace is incorrect.
> 
> In what way? Please specify.
> 
> I suspect that your thinking here is simply that a spec does not (yet) exist
> for the qp_xml API. Specifically, it issues namespace/localname tuple pairs:
> 
>   ('DAV:', 'response')
> 
> When you have no namespace, you get:
> 
>   ('', 'some-element')
> 
> When the xml: prefix is found, it returns:
> 
>   ('', 'xml:foobar')
> 
> This is done because qp_xml does not preserve prefixes. Thus, an application
> is required to manufacture prefixes when dumping the QP tree back out. The
> particular tuple format for xml: prefix does two things:
> 1) '' signifies no namespace, so a prefix is not generated for the name
> 2) 'xml:' in the elem name ensure that the xml: prefix gets dumped out
> 
> If we returned the data in another way, the application might accidentally
> replace the prefix with something other than xml:.

You lost me somewhere.  It is simply impossible in an XML/NS-compliant 
application, for the "xml" prefix to be associated with no namespace.  From 
your own description I think you have a bug.  When the xml prefix is found, 
you should return

('http://www.w3.org/XML/1998/namespace', 'xml:foobar')


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +01 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python