You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2015/12/22 12:03:46 UTC

svn commit: r1721345 - /santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java

Author: coheigea
Date: Tue Dec 22 11:03:45 2015
New Revision: 1721345

URL: http://svn.apache.org/viewvc?rev=1721345&view=rev
Log:
[SANTUARIO-436] - XmlWriterToTree calls DOM with invalid global namespace URI. Thanks to Clement Pellerin for the patch.

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java?rev=1721345&r1=1721344&r2=1721345&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java Tue Dec 22 11:03:45 2015
@@ -87,6 +87,11 @@ public class XmlWriterToTree implements
 
     @Override
     public void writeStartElement(String prefix, String localName, String namespaceURI) {
+        if ("".equals(namespaceURI)) {
+            // Map global namespace from StAX to DOM
+            namespaceURI = null;
+        }
+
         Element newElem = factory.createElementNS(namespaceURI, DOMUtils.getQNameString(prefix, localName));
         if (nextSibling != null) {
             newElem = (Element)nextSibling.getParentNode().insertBefore(newElem, nextSibling);
@@ -143,6 +148,11 @@ public class XmlWriterToTree implements
 
         Attr result = null;
         if (value != null) {
+            if ("".equals(namespaceURI)) {
+                // Map global namespace from StAX to DOM
+                namespaceURI = null;
+            }
+
             result = factory.createAttributeNS(namespaceURI, DOMUtils.getQNameString(prefix, localName));
             result.setTextContent(value);
             if (! (currentNode instanceof Element)) {