in reply to XML parsing problem
In the chatterbox the OP said he is trying to use XML::Simple as he does not understand XML::Twig. Please allow me to show an XML::Twig example in case he changes his mind.
use warnings; use strict; use XML::Twig; my $twig = XML::Twig->new; $twig->parse(*DATA); for my $query ($twig->findnodes("/queries/query")) { my $name = $query->field("name"); my $topN = $query->field("topN"); print "query name=($name) topN=($topN)\n"; } __DATA__ <?xml version='1.0'?> <queries> <query> <name>topHosts</name> <layer>LINK</layer> <topN>20</topN> <datatype>topHosts</datatype> <filter></filter> </query> <query> <name>topHosts</name> <layer>LINK</layer> <topN>120</topN> <datatype>topHosts</datatype> <filter></filter> </query> </queries>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML parsing problem
by runrig (Abbot) on Mar 10, 2009 at 20:25 UTC | |
by Your Mother (Archbishop) on Mar 10, 2009 at 20:57 UTC |