Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: XML Manipulation

by mirod (Canon)
on Nov 19, 2010 at 20:03 UTC ( #872584=note: print w/replies, xml ) Need Help??

in reply to XML Manipulation

How complex are those XPath expression? If they are simple and do not require backtracking, then XML::Twig is ideal for it: set the twig_roots option to a hash <xpath> => 1, then use the twig_print_outside_roots option to output the rest of the XML. See "Building an XML filter" in the docs for an example of that kind of processing, and "twig_handlers" to see the subset of XPath that you can use in this mode.

Alternatively you can use XML::Twig::XPath, parse the file, then go through you list of XPath expressions, use findnodes to get the hits, and delete them.

Beyond XML::Twig, you could try XML::LibXML, which also supports XPath. it is faster and better maintained than XML::XPath. Processing would be the same as above.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872584]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2018-08-18 12:04 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (185 votes). Check out past polls.