in reply to A sane method for parsing deeply nested XML
I remember trying to parse some not-well-documented xml.zip format myself, writing similar code using XML::Simple. Unfortunately, I didn't have a chance to rewrite it using XML::Twig. Fortunately, now it's not used anywhere.
What about writing something like this?
The code is fully untested, but I could try fixing it if you provide a bit of example input data.use XML::Twig; my @fails; my $parser = XML::Twig::->new(twig_roots => { '/items/client/site/servers/server/failed_checks/check/description' = +> sub { push @fails, $_->text }, '/items/client/site/servers/server/overdue/description' => sub { push + @fails, $_->text }, })->parse_file($fail); my $report = @fails ? 1 : 0;
Another option could be using Data::Diver.
|
|---|