toddgow has asked for the wisdom of the Perl Monks concerning the following question:
What the is the best method to do this? In the XML::Twig docs it only has an example of using a filehandle with twig_print_outside_roots. Thanks in advance, ToddMy XML File: <script type="ApplicationPerspective" version="5.3.13.179" recorder="8 +.6.59.276" sav="25" guid="296A95D0-E8B6-4989-AA21-126796A3AD3F" xmlns +="http://www.keynote.com/namespaces/tstp/script"> <name> <![CDATA[GT Amadeus]]> </name> <actions> <action FrameErrorFatal="1" MetaErrorFatal="1"> <name> <![CDATA[Home Page]]> </name> <description> <![CDATA[]]> </description> </action> </actions> </script> use strict; use warnings; use XML::Twig; my $file = $ARGV[0]; my $output = "/home/todd/Scripts/output.txt"; open( OUT, ">$output") or die "can't open file: $!"; my $twig = new XML::Twig( twig_handlers => { name => \&name } ); $twig->parsefile($file); sub name { my ($twig, $name) = @_; my $stuff = $name->text(); $stuff->print( \*OUT); # print "$stuff\n"; $twig->purge; } close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig output to filehandle
by eff_i_g (Curate) on Feb 12, 2009 at 22:02 UTC | |
by poolpi (Hermit) on Feb 13, 2009 at 08:30 UTC | |
by mirod (Canon) on Feb 13, 2009 at 08:41 UTC | |
by Anonymous Monk on Feb 13, 2009 at 09:03 UTC | |
by mirod (Canon) on Feb 13, 2009 at 09:32 UTC |