diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2007-11-20 14:28:05 +0000 |
---|---|---|
committer | <> | 2013-08-08 17:01:04 +0000 |
commit | c97631728ce7d6d3f4692a56c3cda7476b42a968 (patch) | |
tree | 8c00053771ccae41a737eecd072dbb3cd8b06fdd /t/partial.t | |
download | perl-xml-parser-master.tar.gz |
Imported from /home/lorry/working-area/delta_perl-xml-parser/XML-Parser-2.36.tar.gz.HEADXML-Parser-2.36master
Diffstat (limited to 't/partial.t')
-rw-r--r-- | t/partial.t | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/t/partial.t b/t/partial.t new file mode 100644 index 0000000..c94c9b8 --- /dev/null +++ b/t/partial.t @@ -0,0 +1,40 @@ +BEGIN {print "1..3\n";} +END {print "not ok 1\n" unless $loaded;} +use XML::Parser; +$loaded = 1; +print "ok 1\n"; + +my $cnt = 0; +my $str; + +sub tmpchar { + my ($xp, $data) = @_; + + if ($xp->current_element eq 'day') { + $str = $xp->original_string; + $xp->setHandlers(Char => 0); + } +} + +my $p = new XML::Parser(Handlers => {Comment => sub {$cnt++;}, + Char => \&tmpchar + }); + +my $xpnb = $p->parse_start; + +open(REC, 'samples/REC-xml-19980210.xml'); + +while (<REC>) { + $xpnb->parse_more($_); +} + +close(REC); + +$xpnb->parse_done; + +print "not " unless $cnt == 37; +print "ok 2\n"; + +print "not " unless $str eq '&draft.day;'; +print "ok 3\n"; + |