[jbossws-commits] JBossWS SVN: r14847 - in stack/native/branches/jbossws-native-3.1.2: modules/core and 3 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Mon Aug 15 13:02:58 EDT 2011
Author: klape
Date: 2011-08-15 13:02:58 -0400 (Mon, 15 Aug 2011)
New Revision: 14847
Modified:
stack/native/branches/jbossws-native-3.1.2/
stack/native/branches/jbossws-native-3.1.2/modules/core/
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java
Log:
[JBPAPP-5866] Removing redundant namespace declarations
Property changes on: stack/native/branches/jbossws-native-3.1.2
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365:14192
/stack/native/branches/jbossws-native-3.4.0.SP1:13928,13933,13936,13946
/stack/native/trunk:12502,13992,14157,14160,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365:14192
/stack/native/branches/jbossws-native-3.4.0.SP1:13928,13933,13936,13946
/stack/native/trunk:12502,13992,14157,14160,14181,14183,14842
Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/core
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/core:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/core:13928,13933,13936,13946
/stack/native/trunk/modules/core:12502,13992,14011,14157,14160,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/core:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/core:13928,13933,13936,13946
/stack/native/trunk/modules/core:12502,13992,14011,14157,14160,14181,14183,14842
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2011-08-15 15:01:43 UTC (rev 14846)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2011-08-15 17:02:58 UTC (rev 14847)
@@ -21,6 +21,10 @@
*/
package org.jboss.ws.core.soap;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import javax.xml.namespace.QName;
import javax.xml.soap.Detail;
import javax.xml.soap.Name;
@@ -34,6 +38,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.wsf.common.DOMUtils;
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -153,10 +158,39 @@
}
}
}
-
+ Iterator ite = soapElement.getNamespacePrefixes();
+ List<String> prefixs = new ArrayList<String>();
+ while (ite != null && ite.hasNext())
+ {
+ prefixs.add((String) ite.next());
+ }
+ removeNSAttribute(soapElement, prefixs);
return soapElement;
}
+ private void removeNSAttribute(SOAPElement soapElement, List<String> prefixes)
+ {
+ Iterator ite2 = soapElement.getChildElements();
+ while (ite2 != null && ite2.hasNext())
+ {
+ Object obj = ite2.next();
+ if (obj instanceof SOAPElement)
+ {
+ SOAPElement ele = (SOAPElement) obj;
+ removeNSAttribute(ele, prefixes);
+ for (String str : prefixes)
+ {
+ Attr attr = ele.getAttributeNode("xmlns:" + str);
+ if (attr != null)
+ ele.removeAttribute("xmlns:" + str);
+
+ }
+ }
+
+ }
+
+ }
+
@Override
public Detail createDetail() throws SOAPException
{
Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/testsuite/native-tests:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/testsuite/native-tests:13928,13933,13936,13946
/stack/native/trunk/modules/testsuite/native-tests:12502,13992,14013,14157,14160,14181,14183
+ /stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-6365/modules/testsuite/native-tests:14192
/stack/native/branches/jbossws-native-3.4.0.SP1/modules/testsuite/native-tests:13928,13933,13936,13946
/stack/native/trunk/modules/testsuite/native-tests:12502,13992,14013,14157,14160,14181,14183,14842
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java 2011-08-15 15:01:43 UTC (rev 14846)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java 2011-08-15 17:02:58 UTC (rev 14847)
@@ -21,12 +21,21 @@
*/
package org.jboss.test.ws.common.soap;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.Detail;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPFactory;
import org.jboss.wsf.test.JBossWSTest;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
/**
* Test the SOAPFactory
@@ -84,5 +93,28 @@
assertEquals("pre", name.getPrefix());
assertEquals("http://someURI", name.getURI());
}
+
+
+ public void testNSDeclaration() throws Exception
+ {
+ String CONTENTS =
+ "<say:sayHiResponse xmlns:say='http://www.jboss.org/sayHi' xmlns:say2='http://www.jboss.org/sayHi2'>" +
+ "<say2:arg0><say2:arg2>Response</say2:arg2></say2:arg0>" +
+ "</say:sayHiResponse>" ;
+
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance() ;
+ builderFactory.setNamespaceAware(true);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder() ;
+
+ Document doc = builder.parse(new InputSource(new StringReader(CONTENTS))) ;
+ Element root = doc.getDocumentElement() ;
+
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPElement soapElement = factory.createElement(root) ;
+ NodeList elementList = soapElement.getElementsByTagName("say2:arg2");
+ Element element = (Element)elementList.item(0);
+ Attr attr = element.getAttributeNode("xmlns:say2");
+ assertNull(attr);
+ }
}
More information about the jbossws-commits
mailing list