in reply to Incremental parsing of multiple XML streams?
I did find a parse_more method in XML::Parser::ExpatNB, which looked like it might do the trick, but never got around to actually seeing if it could parse unbalanced xml snippets.
UPDATE
I did some hacking on the ExpatNB solution, here's what I came up with. It would have been much better than stream mender I put together myself.
#!/usr/bin/env/perl use strict; use warnings; use XML::Parser::Expat; use Data::Dumper qw(Dumper); my $parser = XML::Parser::ExpatNB->new(); $parser->setHandlers('Start' => \&sh, 'End' => \&eh, 'Char' => \&ch); foreach my $snippet qw( < bro ke nx ml> con tent < /bro kenxm l> ) { print "Waiting for an event...\n"; $parser->parse_more($snippet); } sub sh { print "A start element: ", Dumper($_[1]), "\n"; } sub eh { print "An end element: ", Dumper($_[1]), "\n"; } sub ch { print "Some Data: ", Dumper($_[1]), "\n"; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Incremental parsing of multiple XML streams?
by nothingmuch (Priest) on Jan 08, 2005 at 14:14 UTC | |
|
Re^2: Incremental parsing of multiple XML streams?
by nothingmuch (Priest) on Jan 08, 2005 at 23:50 UTC |