copying nodes from xpath results to a domxml
Posted: Fri Feb 01, 2008 10:42 am
hi all,
i am doing a search with xpath and returning nodesets that match a string.
from there i would like to copy these node sets into another domxml element in memory.
so example my xml looks like this
<block>
<var1>blah</var1>
....
<var55>blah</var55>
</block>
<block>
<var1>blah blah</var1>
...
<var55>blah 2</var55>
</block>
so when i search for blah and get back 2 node sets i would like (ideally) to copy everything in side the <block> tags and put them in a new xml dom element i created. However i can't seem hoow to figure it out.
i would like to get all the child nodes of <block> without having to create them manually (as they may change)
any one have a sample code i can try? i already have the xpath working fine and it returns these node sets, i just dont know how to copy all child nodes to a new element. i can create a new element tag with the proper name, but i cannot seem to add the data into the elements.
thanks in advance,
mcm
i am doing a search with xpath and returning nodesets that match a string.
from there i would like to copy these node sets into another domxml element in memory.
so example my xml looks like this
<block>
<var1>blah</var1>
....
<var55>blah</var55>
</block>
<block>
<var1>blah blah</var1>
...
<var55>blah 2</var55>
</block>
so when i search for blah and get back 2 node sets i would like (ideally) to copy everything in side the <block> tags and put them in a new xml dom element i created. However i can't seem hoow to figure it out.
i would like to get all the child nodes of <block> without having to create them manually (as they may change)
any one have a sample code i can try? i already have the xpath working fine and it returns these node sets, i just dont know how to copy all child nodes to a new element. i can create a new element tag with the proper name, but i cannot seem to add the data into the elements.
thanks in advance,
mcm