JDK-6949607 : JAXP issue 63 : attribute is accessible with invalid namespace
  • Type: Bug
  • Component: xml
  • Sub-Component: org.xml.sax
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-05-04
  • Updated: 2012-04-25
  • Resolved: 2010-05-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.0 1.4Fixed 6u21Fixed 7Fixed
Related Reports
Relates :  
Refer to: https://jaxp.dev.java.net/issues/show_bug.cgi?id=63

attributes with defined prefix (namespace) is accessible with "empty" namespace.

for example

xml: <prefix:rootElem xmlns:prefix="something" prefix:attr="attrValue" />

    public void startElement(String uri, String localName, String qName,
Attributes atts) throws SAXException {

        super.startElement(uri, localName, qName, atts);

        String attr_WithNs = atts.getValue("something", "attr");
        String attr_NoNs = atts.getValue("", "attr");


attr_NoNs should be null but atts.getValue returns same thing as is set in

This is confirmed regression (introduced in JDK6_18, present in OpenJDK7).

EVALUATION Looks like the change for sjsxp issue 63 (https://sjsxp.dev.java.net/issues/show_bug.cgi?id=63) has caused a regression in SAX. In sjsxp issue 63, a request was made to treat empty string the same as null for XMLStreamReader's getAttributeValue method. Unfortunately, this change breaks SAX Attributes' getValue(uri, localName) which was defined explicitly that the empty String means no Namespace URI. Since XMLStreamReader's getAttributeValue only required null to be treated, no mention of empty string, that the namespace is not checked for equality, I suggest we roll back the change for sjsxp issue 63. The patch was made under CR6840792 which covers both sjsxp issue 63 and 70. The part for 70 is fine.