File: partial.t

package info (click to toggle)
libxml-parser-perl 2.34-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 804 kB
  • ctags: 150
  • sloc: xml: 3,937; perl: 1,478; makefile: 47; ansic: 27
file content (40 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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";