|
[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
> 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








