You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/04/05 08:45:25 UTC
[Bug 1225] New - The URI "http://www.w3.org/2000/xmlns/" is illegally required for attributes with prefix "xmlns"
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1225
*** shadow/1225 Wed Apr 4 23:45:25 2001
--- shadow/1225.tmp.9666 Wed Apr 4 23:45:25 2001
***************
*** 0 ****
--- 1,57 ----
+ +============================================================================+
+ | The URI "http://www.w3.org/2000/xmlns/" is illegally required for attribut |
+ +----------------------------------------------------------------------------+
+ | Bug #: 1225 Product: Xerces-J |
+ | Status: NEW Version: 1.3.1 |
+ | Resolution: Platform: PC |
+ | Severity: Major OS/Version: |
+ | Priority: High Component: DOM |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xerces-j-dev@xml.apache.org |
+ | Reported By: gregor.karlinger@gmx.net |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ If I would like to add a namespace attribute to a DOM element
+ using method Element.setAttributeNS I have to specify the
+ URI "http://www.w3.org/2000/xmlns/" for the parameter
+ "namespaceURI".
+
+ This contradicts with section 4 of the W3C namespace recommendation
+ (http://www.w3.org/TR/REC-xml-names/#nsc-NSDeclared), where it reads:
+
+ "The prefix xmlns is used only for namespace bindings and is not
+ itself bound to any namespace name."
+
+ I have also found out that Xerces behaves correct when parsing a
+ XML document that contains such a namespace attribute. Consider
+ this example:
+
+ <rootElem xmlns:myNS="http://anywhere.ns"/>
+
+ In the resulting DOM object I can find a single attribute for
+ "rootElem" which has following values:
+
+ qualified name: "xmlns:myNS"
+ prefix: "xmlns"
+ name: "myNS"
+ namespace uri: ""
+
+ So, this behaviour contradicts the behaviour described above,
+ when I try to manually construct a DOM object with a namespace
+ attribute.
+
+ I think I have located the problem in AttrNSImpl.java,
+ lines 134 - 137 and 85 respectively, where it reads:
+
+ 85: static final String xmlnsURI = "http://www.w3.org/2000/xmlns/";
+
+ 134: } else if (prefix.equals("xmlns")) {
+ 135: if (!namespaceURI.equals(xmlnsURI)) {
+ 136: throw new DOMException(DOMException.NAMESPACE_ERR,
+ 137: "DOM003 Namespace error");
+
+ I think a solution is to change the "xmlnsURI" to the value "",
+ but I haven't thought about any side effects.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org