Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Re: Re: XML::Twig - can't find my uncle!

by aardvark (Pilgrim)
on May 23, 2001 at 09:02 UTC ( #82471=note: print w/replies, xml ) Need Help??

in reply to Re: Re: XML::Twig - can't find my uncle!
in thread XML::Twig - can't find my uncle!

ok, how about this?
use strict; use XML::Twig; my $file = 'uncle.xml'; my $twig = new XML::Twig; $twig->parsefile($file); my $root = $twig->root; my @messages = $root->children; foreach my $msg (@messages) { my $error = $msg->first_child('error'); my $result = $msg->first_child('request'); my $error_name = $error->att('name'); my $result_name = $result->att('name'); if ($error_name && $result_name) { print "ERROR : $error_name \n"; print "RESULT : $result_name \n"; } }
Get Strong Together!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://82471]
[tye]: because s/// doesn't support an 'r' option?
[tye]: (in your version of Perl?)
[tye]: no, thankfully (at least my version of Perl) has a different error for that.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2016-12-07 18:19 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (131 votes). Check out past polls.