Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: XPATH DOM traverse html/xml

by benizi (Hermit)
on Dec 09, 2009 at 06:18 UTC ( #811863=note: print w/replies, xml ) Need Help??

in reply to Re: XPATH DOM traverse html/xml
in thread XPATH DOM traverse html/xml

XML::Twig is one of the many things that keeps me using Perl. (It's one of the modules my personal '' module loads -- '' so I can do perl -MM -lwe ....) So, thanks again, mirod.

The first thing that came to mind was:

perl -MXML::Twig -E 'XML::Twig->new( twig_handlers => { _all_ => sub { say $_->xpath } })->parsefile(shift)'

...which isn't so different from what you wrote. But, the following has the benefit of not requiring the loading of the entire file (correct?):

perl -MXML::Twig -E 'XML::Twig->new( start_tag_handlers => { _all_ => sub { say $_->xpath } })->parsefile(shift)'

Replies are listed 'Best First'.
Re^3: XPATH DOM traverse html/xml
by mirod (Canon) on Dec 09, 2009 at 13:18 UTC

    Absolutely, the way you wrote it is more efficient. I just went for the easiest way I could think of, not knowing enough about the OP's exact constraints.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-05-26 15:37 GMT
Find Nodes?
    Voting Booth?