logo       

Re: DOM : removeall nodes with xpath: msg#00030

mozilla.devel.dom

Subject: Re: DOM : removeall nodes with xpath


>I think the problem you
> run into is that you use nextSibling.nextSibling trying to move from
> element to element node however after the removal of one <node
> about="node:3" label="hello"/> element node there are two adjacent white
> space text nodes between
> <node about="node:2" />
> and
> <node about="node:4" />


Many thanks again - I hadnt appreciated the significance of the interleaved
whitespace nodes

So does this mean I should ALSO be able to just remove the target's
associated white space node using
something like nextsibling.removeChild so preserving the interleaved
format.......

.. and can I always assume interleaved whitespace nodes are always created
during xmldoc.load() ?

> So the document is fine, only your loop is not adequate to loop through
> element nodes, consider using xmlDocument.getElementsByTagName('node')
> if you want to loop through the element nodes.

I wanted to work with the xpath result set because I want to specify
non-trivial deletion conditions.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise