From: "Mike Blezien" <[EMAIL PROTECTED]>
> I need to parse a fairly large XML response file and would like some
> suggestions
> on which XML module would work the best. We've been using the XML::Simple
> module, but I don't think that's the right one for the job. Below is the XML
> file we need to parse. In particular getting the data from the elements
> within
> the <message></message>
You might (or maybe not ;-) want to have a look at XML::Rules. It
let's you specify just what part of the data in a tag to remember, it
let's you process the data once a convenient tag gets fully parsed
including the children and closing tags etc.
In this case something like
use XML::Rules;
my $parser = XML::Rules->new(
rules => [
message => 'content array',
'raiserisklevel,lowerrisklevel,informational' => sub { $_[0] =>
$_[1]->{message}},
messaging => sub {
do something with @{$_[1]->{raiserisklevel}}, @{$_[1]-
>{lowerrisklevel}} and @{$_[1]->{informational}}
},
...
]
);
$parser->parse( $filename);
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/