You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/03/02 15:45:15 UTC

svn commit: r918058 - in /cxf/trunk/common/common/src/main/java/org/apache/cxf: helpers/DOMUtils.java staxutils/W3CDOMStreamWriter.java

Author: dkulp
Date: Tue Mar  2 14:45:14 2010
New Revision: 918058

URL: http://svn.apache.org/viewvc?rev=918058&view=rev
Log:
Always create the NS versions of elements and attributes

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=918058&r1=918057&r2=918058&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Tue Mar  2 14:45:14 2010
@@ -186,7 +186,7 @@
 
     public static void setAttribute(Node node, String attName, String val) {
         NamedNodeMap attributes = node.getAttributes();
-        Node attNode = node.getOwnerDocument().createAttribute(attName);
+        Node attNode = node.getOwnerDocument().createAttributeNS(null, attName);
         attNode.setNodeValue(val);
         attributes.setNamedItem(attNode);
     }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java?rev=918058&r1=918057&r2=918058&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java Tue Mar  2 14:45:14 2010
@@ -97,7 +97,7 @@
     }
 
     public void writeStartElement(String local) throws XMLStreamException {
-        newChild(document.createElement(local));
+        newChild(document.createElementNS(null, local));
     }
 
     protected void newChild(Element element) {
@@ -169,7 +169,12 @@
     }
 
     public void writeAttribute(String local, String value) throws XMLStreamException {
-        Attr a = document.createAttribute(local);
+        Attr a;
+        if (local.startsWith("xmlns:")) {
+            a = document.createAttributeNS(XML_NS, local);
+        } else {
+            a = document.createAttributeNS(null, local);
+        }
         a.setValue(value);
         ((Element)currentNode).setAttributeNode(a);
     }