Author: jim.ma
Date: 2011-03-24 12:05:57 -0400 (Thu, 24 Mar 2011)
New Revision: 13928
Modified:
stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
Log:
[JBWS-3251]:Use element's OwnerDocument to create Child
Modified:
stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
---
stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2011-03-24
16:04:18 UTC (rev 13927)
+++
stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2011-03-24
16:05:57 UTC (rev 13928)
@@ -75,7 +75,7 @@
public SOAPElementImpl(String localPart, String prefix, String nsURI)
{
super(DOMUtils.createElement(localPart, prefix, nsURI));
- this.element = (Element)domNode;
+ this.element = (Element)domNode;
}
/** Called by SOAPFactory */
@@ -83,6 +83,13 @@
{
this(name.getLocalName(), name.getPrefix(), name.getURI());
}
+
+ /** Called by addChild */
+ private SOAPElementImpl(Element element)
+ {
+ super(element);
+ this.element = element;
+ }
/** Called by SOAPFactory */
public SOAPElementImpl(QName qname)
@@ -228,10 +235,19 @@
* @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
*/
public SOAPElement addChildElement(Name name) throws SOAPException
- {
- SOAPElement soapElement = new SOAPElementImpl(name);
- soapElement = addChildElement(soapElement);
- return soapElement;
+ {
+ Document doc = this.element.getOwnerDocument();
+ Element childEle = null;
+ if (name.getPrefix() == null || name.getPrefix().length() == 0)
+ {
+ childEle = doc.createElementNS(name.getURI(), name.getLocalName());
+ } else
+ {
+ childEle = doc.createElementNS(name.getURI(), name.getPrefix() + ":" +
name.getLocalName());
+ }
+
+ SOAPElement child = new SOAPElementImpl(childEle);
+ return addChildElement(child);
}
public SOAPElement addChildElement(QName qname) throws SOAPException
Show replies by date