Author: alessio.soldano(a)jboss.com
Date: 2010-03-15 09:20:12 -0400 (Mon, 15 Mar 2010)
New Revision: 11781
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
Log:
[JBWS-2940] Further clean up message when moving from XML_VALID to DOM_VALID
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2010-03-15
13:18:17 UTC (rev 11780)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2010-03-15
13:20:12 UTC (rev 11781)
@@ -313,19 +313,28 @@
// Remove all child nodes
container.removeContents();
- // In case of dispatch and provider we use artifical element names
+ // In case of dispatch and provider we use artificial element names
// These need to be replaced (costly!)
if (artificalElement)
{
container.setElementQNameInternal(contentRootName);
}
- Document ownerDoc = container.getOwnerDocument();
+ // Process attributes: we copy from the fragment element to the previous container
element, after having cleaned the latter
+ // to prevent useless / redundant namespace declarations with multiple prefixes. We
also update the prefix of the container
+ // element to ensure proper namespace is configured for it
+ String oldPrefix = container.getPrefix();
+ if (oldPrefix != null)
+ {
+ container.removeNamespaceDeclaration(oldPrefix);
+ }
DOMUtils.copyAttributes(container, domElement);
container.setPrefix(domElement.getPrefix());
SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ // Add new child nodes
+ Document ownerDoc = container.getOwnerDocument();
NodeList nlist = domElement.getChildNodes();
for (int i = 0; i < nlist.getLength(); i++)
{