Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How on earth do I use this script

by diamondsandperls (Beadle)
on Sep 27, 2012 at 19:24 UTC ( #996071=perlquestion: print w/ replies, xml ) Need Help??
diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:

Once upon a time I used the script provided at the below link for parsing xml to something easier in order to pull out refs. I did not save my command line syntax and for whatever reason or another I can no longer get this to work properly. Any help is appreciated.

Re: easy way of parsing XML

Comment on How on earth do I use this script
Re: How on earth do I use this script
by remiah (Hermit) on Sep 27, 2012 at 22:00 UTC

    Hello.

    I tried this but I saw this script works just fine. How do you invoke the program? I did like this.

    perl this_pg.pl target.xml SOMETHING 1
    With XML::Twig, similar things would go like this.
    use strict;use warnings; use XML::Twig; my $xmlfile=$ARGV[0]; my $values_flag=$ARGV[0] || 0; my $twig =XML::Twig->new( twig_handlers => {'//*' => sub { my($twig,$elt)=@_; if ( $elt->descendants == 1 ){ print $elt->path; print " := " . $elt->first_child_text if ( $values_fla +g ); print "\n"; } } }, )->parsefile($xmlfile);

      thanks got it to go

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://996071]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2015-07-05 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls