Hi Andreas,

In ParentNode.insertBefore(Node newChild, Node refChild) method i came
across following bit of code,

ChildNode newDomChild = (ChildNode) newChild;
ChildNode refDomChild = (ChildNode) refChild;

....
....
....

boolean compositeChild = newDomChild.nextSibling != null;
        ChildNode endChild = null;

        if(compositeChild) {
            ChildNode tempNextChild = newDomChild.nextSibling;
            while(tempNextChild != null) {
                tempNextChild.parentNode = this;
                endChild = tempNextChild;
                tempNextChild = tempNextChild.nextSibling;
            }
 }

And this code was hitting when adding a node. Since above code is
written specifically, i was under impression that it is the behaviour
of it. And didnt realise that this code was hitting when moving node,
due to an issue in detach. Therefore i took the approach in patch to
fix the issue. Thats where i got "composite element" concept into my
mind.

Sorry for the inconvenience.

Thanks
AmilaJ



On Thu, Sep 29, 2011 at 12:24 PM, Andreas Veithen
<andreas.veit...@gmail.com> wrote:
> Sorry, but this change is complete nonsense. There is no such thing as
> a "composite element" and moving a node never moves its siblings (but
> only its children). This is actually a bug in the Axiom DOM
> implementation: the detach() method fails to reset the nextSibling
> attribute of the node.
>
> Andreas
>
> On Thu, Sep 29, 2011 at 13:06,  <thilin...@apache.org> wrote:
>> Author: thilinamb
>> Date: Thu Sep 29 11:06:11 2011
>> New Revision: 1177260
>>
>> URL: http://svn.apache.org/viewvc?rev=1177260&view=rev
>> Log:
>> Committing the patch provided by AmilaJ for RAMPART-336.
>>
>> Modified:
>>    
>> axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java
>>
>> Modified: 
>> axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java
>> URL: 
>> http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java?rev=1177260&r1=1177259&r2=1177260&view=diff
>> ==============================================================================
>> --- 
>> axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java
>>  (original)
>> +++ 
>> axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java
>>  Thu Sep 29 11:06:11 2011
>> @@ -217,6 +217,10 @@ public class Axis2Util {
>>                         // it is a header we have added in rampart eg. 
>> EncryptedHeader and should
>>                         // be converted to SOAPHeaderBlock for processing
>>                        } else {
>> +                            // First detach element from soap header
>> +                            element.detach();
>> +
>> +                            // add new element
>>                                header = 
>> soapHeader.addHeaderBlock(element.getLocalName(), element.getNamespace());
>>                                Iterator attrIter = 
>> element.getAllAttributes();
>>                                while (attrIter.hasNext()) {
>> @@ -231,14 +235,17 @@ public class Axis2Util {
>>                                // retrieve all child nodes (including any 
>> text nodes)
>>                                // and re-attach to header block
>>                                Iterator children = element.getChildren();
>> -                               while (children.hasNext()) {
>> +
>> +                            // Element is a composite element, in which it 
>> has many siblings.
>> +                            // All siblings will be added when we add a 
>> single node.
>> +                            // See ParentNode.insertBefore(Node newChild, 
>> Node refChild) for
>> +                            // more information.
>> +                               if (children.hasNext()) {
>>                                        OMNode child = 
>> (OMNode)children.next();
>>                                        children.remove();
>>                                        header.addChild(child);
>>                                }
>> -
>> -                               element.detach();
>> -
>> +
>>                                soapHeader.build();
>>
>>                                header.setProcessed();
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
> For additional commands, e-mail: java-dev-h...@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to