Next in thread → Next in month →

RE: [xml-dev] qName/localName confusion

From
Michael Kay <>
To
'John Cowan' <>
Date
2004-03-18T10:27:55
ID
<20040318102716.NKJF14417.mta02-svc.ntlworld.com@Turtle>
Thread
RE: [xml-dev] qName/localName confusion
# 
# > Firstly, turning on the feature might fail. I don't know how many 
# > parsers don't support the feature; I would have to decide 
# whether to 
# > support such parsers or not; I would have to test the code 
# that handles such a failure.
# 
# This is a required feature.  Of course, that doesn't mean all 
# parsers actually do it.

We're talking about the namespace-prefixes feature: 

From XMLReader#setFeature:

All XMLReaders are required to support setting
http://xml.org/sax/features/namespaces to true and
http://xml.org/sax/features/namespace-prefixes to false.

and from ContentHandler#startElement:

The attribute list will contain attributes used for Namespace declarations
(xmlns* attributes) only if the
http://xml.org/sax/features/namespace-prefixes  property is true (it is
false by default, and support for a true value is optional).


# 
# > Secondly, the parser would then give me namespace 
# declarations in the 
# > attributes list that I'm not interested in. It would 
# presumably have 
# > to do extra work to put them there, and I would have to do 
# extra work 
# > to take them out again.
# 
# I don't follow this.  Setting namespace-prefixes means that 
# you get the prefixes associated with each element and 
# attribute that has one.
# It doesn't involve inserting new attributes.

See above.

Michael Kay
Next in thread → Next in month →