Author: thomas.diesler(a)jboss.com
Date: 2007-03-27 13:17:38 -0400 (Tue, 27 Mar 2007)
New Revision: 2695
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/HRefInlineHandler.java
Log:
Copy most attributes, except id
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/HRefInlineHandler.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/HRefInlineHandler.java 2007-03-27
17:06:43 UTC (rev 2694)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/HRefInlineHandler.java 2007-03-27
17:17:38 UTC (rev 2695)
@@ -32,11 +32,13 @@
import javax.xml.soap.SOAPException;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
/**
- * Inline all rpc/encoded hrefs
+ * Inline rpc/encoded hrefs
*
* @author Thomas.Diesler(a)jboss.com
* @since 27-Mar-2007
@@ -79,6 +81,7 @@
private void processElement(SOAPElement soapElement) throws SOAPException
{
+ // Do inner first outer last
Iterator it = soapElement.getChildElements();
while (it.hasNext())
{
@@ -119,10 +122,10 @@
// Remove old content
hrefElement.removeContents();
- // Copy attributes
- DOMUtils.copyAttributes(hrefElement, idElement);
- hrefElement.removeAttribute("id");
+ // Copy most attributes, except id
+ copyMostAttributes(hrefElement, idElement);
+ // Append id element children
if (idElement.getChildElements().hasNext())
{
Iterator itid = idElement.getChildElements();
@@ -132,10 +135,28 @@
hrefElement.appendChild(childNode);
}
}
+ // If no children, copy the value
else
{
String value = idElement.getValue();
hrefElement.setValue(value);
}
}
+
+ private void copyMostAttributes(Element destElement, Element srcElement)
+ {
+ NamedNodeMap attribs = srcElement.getAttributes();
+ for (int i = 0; i < attribs.getLength(); i++)
+ {
+ Attr attr = (Attr)attribs.item(i);
+ String uri = attr.getNamespaceURI();
+ String qname = attr.getName();
+ String value = attr.getNodeValue();
+
+ // Do not copy the id attribute
+ if ("id".equals(qname) == false)
+ destElement.setAttributeNS(uri, qname, value);
+ }
+ }
+
}
Show replies by date