Do you think it has something to do with Xalan's Xpath API? Since I'm using
the Xpath to retrieve level2 elements.
-----Original Message-----
From: DingHui [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 10, 2002 1:44 AM
To: [EMAIL PROTECTED]
Subject: Re: I'm having some problem with
cloneNode(true)
I don't think it's the correct behavior.
Maybe it's a bug of Xerces-J 1.4.1, so , try using the
newest version of Xerces-J.
----- Original Message -----
From: "Sean Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 5:11 AM
Subject: I'm having some problem with cloneNode(true)
> I'm having problem assigning attribute values to child
nodes of the newly
> cloned node. I'm using Xerces J v1.4.1
>
> Following is what I did
>
> 1. I'm using cloneNode(true) to deep copy a node. This is
successful.
>
> For example, below is the original node
> <level1 attr1="1">
> <level2 attr2="2.1"/>
> <level2 attr2="2.2"/>
> </level1>
>
> below is the newly cloned node
> <level1 attr1="1">
> <level2 attr2="2.1"/>
> <level2 attr2="2.2"/>
> </level1>
>
> Then I start to assign values to the attributes of the
newly cloned node. I
> plan to assign value for the new node as below
> <level1 attr1="3">
> <level2 attr2="4.1"/>
> <level2 attr2="4.2"/>
> </level1>
>
> finally, I will append the newly cloned node to the parent
of the original
> node
>
> below is what I should have after appending the newly
cloned node
> <level1 attr1="1">
> <level2 attr2="2.1"/>
> <level2 attr2="2.2"/>
> </level1>
> <level1 attr1="3">
> <level2 attr2="4.1"/>
> <level2 attr2="4.2"/>
> </level1>
>
> But I received follow
> <level1 attr1="1">
> <level2 attr2="4.1"/>
> <level2 attr2="4.2"/>
> </level1>
> <level1 attr1="3">
> <level2 attr2="2.1"/>
> <level2 attr2="2.2"/>
> </level1>
>
> Seems to me that attribute values for level1 node is
correctly assigned and
> new values for child nodes for level1 are not assigned to
the newly cloned
> node but assigned to the original node.
>
> Is this the correct behavior? How can I assign the values
to the newly
> cloned node without affecting the original node?
>
> Thanks,
>
> Sean
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]