DOM XML

DOM XML

am 10.09.2007 06:17:10 von Sam

I'm cycling through an DOM Object and removing nodes. My problem is if I
want to remove nodes 1 and 3, it wants to remove nodes 1 and 4, because
once node 1 is removed, node 4 is now in the 3 slot.

Any direction or suggestions?

§

Re: DOM XML

am 10.09.2007 13:55:57 von Jerry Stuckle

sam wrote:
> I'm cycling through an DOM Object and removing nodes. My problem is if I
> want to remove nodes 1 and 3, it wants to remove nodes 1 and 4, because
> once node 1 is removed, node 4 is now in the 3 slot.
>
> Any direction or suggestions?
>
> §

Yep, keep trace of what you want to remove and move the others up, start
from the back end and remove them moving up, or rescan after every removal.

As a general rule, *any* time you change data (not just a DOM object)
the data may be reordered. Never depend on the order remaining the same
after modifying the data - that includes adding and changing data, also
(although those probably wouldn't have an effect in this case).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================