Re: xpath and node deletion
"rvj" <[email protected]> Thu, 30 Dec 2010 17:48:53 -0000
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
... or is ALWAYS possible to construct an xpath expression which excludes
certain nodes
in other words to create the inverse of an xpath?
//* [@type!="2"]
eg select all elements except those with an attibute = 2
"rvj" <[email protected]> wrote in message
news:[email protected]...
>
> sometimes it appears to be easier to remove particular nodes from a
> document than construct muliple xpath nodes sets
>
> is there any convention or method for deleting nodes from a document so
> the bulk of the document is returned?
>
> <root>
>
> <node type=a">
> <leaf type="1"/>
> <leaf type="2"/>
> </node>
> <node type=b">
> <leaf type="1"/>
> <leaf type="2"/>
> </node>
>
>
> </root>
>
>
> and issue something like delete(//leaf[@type="2"]) to delete any type
> 2 leaf element
>