OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: SAX survey: expected local name for non-namespace qualified elements

[ Lists Home | Date Index | Thread Index ]

> Recently I raised some issues about inconsistencies in the SAX 
> documentation with regard to how local names are reported to the 
> startElement() method:
> 
> public void startElement(java.lang.String uri,
>                           java.lang.String localName,
>                           java.lang.String qName,
>                           Attributes atts)
>                    throws SAXException
> 
> Specifically the question is, when namespace processing is turned on 
> as it is by default (i.e. when http://xml.org/sax/features/namespaces 
> is true), is it acceptable for a parser to report the local name of a 
> non-namespace qualified element as the empty string? 

My belief is, no.

The spec says:

* the Namespace URI and local name are required when the namespaces
property is true (the default), and are optional when the namespaces
property is false (if one is specified, both must be); 
* the qualified name is required when the namespace-prefixes property is
true, and is optional when the namespace-prefixes property is false (the
default).

With the default setting of both properties, the spec makes it clear
that provision of the QName is optional. It would be a nonsense to
supply neither the QName nor the local-name, and if the provision of the
local-name depended on the namespaces-prefix property then it would
surely say so; therefore one must conclude that the local-name is
mandatory. In fact, I find it impossible to read "the local name is
required" in any other way.

[Saxon, incidentally, has a restriction that it requires the QName to be
supplied. I haven't fixed this because (a) I've never encountered a
parser that doesn't supply the QName, and (b) it would affect
performance adversely.]

Michael Kay





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS