The xmlns URI should also be used to add NS decls as attributes to a DOM. However, this was only done for attributes that started with 'xmlns:' and not for 'xmlns' (i.e. not for decls of the default NS).


git-svn-id: https://svn.apache.org/repos/asf/xalan/java/trunk@337959 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xml/utils/DOMBuilder.java b/src/org/apache/xml/utils/DOMBuilder.java
index 675da23..548464b 100644
--- a/src/org/apache/xml/utils/DOMBuilder.java
+++ b/src/org/apache/xml/utils/DOMBuilder.java
@@ -299,9 +299,11 @@
           // Crimson won't let us set an xmlns: attribute on the DOM.
           String attrQName = atts.getQName(i);
 
-          // In SAX, xmlns: attributes have an empty namespace, while in DOM they should have the xmlns namespace
-          if (attrQName.startsWith("xmlns:"))
+          // In SAX, xmlns[:] attributes have an empty namespace, while in DOM they 
+          // should have the xmlns namespace
+          if (attrQName.startsWith("xmlns:") || attrQName.equals("xmlns")) {
             attrNS = "http://www.w3.org/2000/xmlns/";
+          }
 
           // ALWAYS use the DOM Level 2 call!
           elem.setAttributeNS(attrNS,attrQName, atts.getValue(i));