xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Goei <edwi...@sun.com>
Subject Re: Crimson 1.1.1 / SAX2 reporting namespace-less element names as qName ratherthan localName
Date Fri, 20 Jul 2001 18:06:34 GMT
benp@marketing.net.uk wrote:
> Hi,
> I'm curious about the behaviour of Crimson 1.1.1 when used as a SAX2
> XMLReader.  For some reason, for XML elements with no namespace, the name
> is returned as the qName parameter to startElement(), rather than localName
> as expected; localName is empty.  We're hoping for flexibility in changing
> parsers (hence the move to 1.1.1 for the better JAXP support), so we'd like
> to acheive consistent behaviour if at all possible.  Is there any way of
> getting Crimson to comply with SAX2 on this?

In the javadoc at
under startElement() it states under Parameters:

    localName - The local name (without prefix), or the empty string if
Namespace processing is not being performed.

If you used crimson 1.1 or the JAXP reference implementation 1.1 before,
did you explicityly turn on namespace processing?  There was a bug in
crimson 1.1 in this area where if you instantiated an XMLReader via
JAXP, the implementation would behave as if namespace processing was on
by default (even though SAXParserFactory#getNamespaceAware() returned
false), but it should have been off to conform to the JAXP spec.  This
was fixed in 1.1.1.

To fix this, you can get the XMLReader instance and call
setFeature(".../namespaces", true) or alternatively call
setNamespaceAware(true) on the SAXParserFactory.  Applications that do
this will then work with all crimson implementations as they will no
longer rely on the default setting.


In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message