in reply to Re: searching the XML file for certain nodes
in thread searching the XML file for certain nodes

Hey, I can do low-memory (and cryptic!) too. And I'll raise you with a one-liner:

perl -MXML::Twig -e'XML::Twig->parse( twig_roots => { q{p[@v="NO"]} => 1 }, twig_print_outside_roots => 1, shift)' myfile.xml

Let's play XML golf! (in which case I'll have to release a special golf-edition of XML::Twig, with shorter option names ;--)

Replies are listed 'Best First'.
Re^3: searching the XML file for certain nodes
by Jenda (Abbot) on Mar 10, 2009 at 23:08 UTC

    I never said XML::Twig can't do it without keeping all the stuff in memory. All I said was that the solutions presented so far do keep the whole filtered data in memory :-)

    I can't complete with that script in the number of characters. Unless I make changes in the module. Whether it's cryptic depends on the beholder. It ain't for me, but who am I to tell, I'm the module author :-).

      module author, mothor, scary mother :)