You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/12/07 20:23:32 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers DOMParser.java
lehors 00/12/07 11:23:32
Modified: java/src/org/apache/xerces/parsers DOMParser.java
Log:
xmlns default attributes must be given the URI the DOM expect
Revision Changes Path
1.30 +17 -2 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- DOMParser.java 2000/11/24 21:51:36 1.29
+++ DOMParser.java 2000/12/07 19:23:31 1.30
@@ -108,7 +108,7 @@
* DOMParser provides a parser which produces a W3C DOM tree as its output
*
*
- * @version $Id: DOMParser.java,v 1.29 2000/11/24 21:51:36 lehors Exp $
+ * @version $Id: DOMParser.java,v 1.30 2000/12/07 19:23:31 lehors Exp $
*/
public class DOMParser
extends XMLParser
@@ -2073,7 +2073,22 @@
catch (SAXException s) {}
AttrImpl attr;
if (nsEnabled) {
- attr = (AttrImpl)fDocumentImpl.createAttributeNS(fStringPool.toString(attributeDecl.uri),attrName);
+ String namespaceURI = fStringPool.toString(attributeDecl.uri);
+ // DOM Level 2 wants all namespace declaration attributes
+ // to be bound to "http://www.w3.org/2000/xmlns/"
+ // So as long as the XML parser doesn't do it, it needs to
+ // done here.
+ String prefix = fStringPool.toString(attributeDecl.prefix);
+ if (namespaceURI == null) {
+ if (prefix != null) {
+ if (prefix.equals("xmlns")) {
+ namespaceURI = "http://www.w3.org/2000/xmlns/";
+ }
+ } else if (attrName.equals("xmlns")) {
+ namespaceURI = "http://www.w3.org/2000/xmlns/";
+ }
+ }
+ attr = (AttrImpl)fDocumentImpl.createAttributeNS(namespaceURI,attrName);
}
else{
attr = (AttrImpl)fDocumentImpl.createAttribute(attrName);