[ 
http://issues.apache.org/jira/browse/AXIS-1819?page=comments#action_12362518 ] 

Changshin Lee commented on AXIS-1819:
-------------------------------------

The change proposed above affects programs which rely on the current mechanism. 
I'd like to hear your opinions on that.

> addChildElement(String) should not namespaceURI
> -----------------------------------------------
>
>          Key: AXIS-1819
>          URL: http://issues.apache.org/jira/browse/AXIS-1819
>      Project: Apache Axis
>         Type: Bug
>   Components: SAAJ
>     Versions: current (nightly)
>     Reporter: Jongjin Choi

>
> Subject : MessageElement#addChildElement(String) should not inherits 
> namespaceURI.
> MessageElement#addChildElement(String) inherits namespaceURI of the element 
> to the added child.
> For example, 
>  MessageFactory mf = MessageFactory.newInstance();
>  SOAPMessage msg = mf.createMessage();
>  SOAPBody sb = msg.getSOAPBody();
>  SOAPElement se1 = sb.addChildElement("echoString", "ns1", 
> "http://tempuri.org";);
>  SOAPElement se2 = se1.addChildElement("value");
>  se2.addTextNode("Hello");
> The expected output will be: (namespace decl is omitted for brevity)
>  
>   <ns1:echoString><value>Hello</value></ns1:echoString>
> But AXis's output is :
>   <ns1:echoString><ns1:value>Hello</value></ns1:echoString>
> Thought the SAAJ spec is not clear about this, the SUN RI does not inherit 
> namespaceURI. I think SUN RI's behavior is right.
> The patch is simple and below.
> Index: java/src/org/apache/axis/message/MessageElement.java
> ===================================================================
> RCS file: 
> /home/cvspublic/ws-axis/java/src/org/apache/axis/message/MessageElement.java,v
> retrieving revision 1.194
> diff -u -r1.194 MessageElement.java
> --- java/src/org/apache/axis/message/MessageElement.java      8 Feb 2005 
> 18:44:36 -0000       1.194
> +++ java/src/org/apache/axis/message/MessageElement.java      15 Feb 2005 
> 10:00:45 -0000
> @@ -1317,8 +1317,8 @@
>       * @see javax.xml.soap.SOAPElement#addChildElement(String)
>       */
>      public SOAPElement addChildElement(String localName) throws 
> SOAPException {
> -        // Inherit parent's namespace
> -        MessageElement child = new MessageElement(getNamespaceURI(),
> +        // DO NOT Inherit parent's namespace.
> +        MessageElement child = new MessageElement("",
>                                                    localName);
>          addChild(child);
>          return child;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to