Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872584]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-05-21 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?