[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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


sax qualified name
> 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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.