| 1 | use Testscip-perl cpan XML-SAX-ExpatXS 1.33 Test/; |
| 2 | BEGIN { planscip-perl cpan XML-SAX-ExpatXS 1.33 main/plan(). tests => 1 } |
| 3 | use XML::SAX::ExpatXSscip-perl cpan XML-SAX-ExpatXS 1.33 XML/SAX/ExpatXS/; |
| 4 | |
| 5 | my $handler = TestH->newscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/new().(); |
| 6 | my $parser = XML::SAX::ExpatXS->newscip-perl cpan XML-SAX-ExpatXS 1.33 XML/SAX/ExpatXS/new().( Handler => $handler ); |
| 7 | |
| 8 | my $xml =<<_xml_; |
| 9 | <foo> |
| 10 | <item>abc</item> |
| 11 | <?PItarget PIdata and more data?> |
| 12 | </foo> |
| 13 | _xml_ |
| 14 | |
| 15 | $parser->parse_stringscip-perl cpan XML-SAX-ExpatXS 1.33 XML/SAX/ExpatXS/parse_string().($xml); |
| 16 | |
| 17 | #warn $handler->{data}; |
| 18 | okscip-perl cpan XML-SAX-ExpatXS 1.33 main/ok().($handler->{data} eq 'PItarget|PIdata and more data'); |
| 19 | |
| 20 | package TestHscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/; |
| 21 | #use Devel::Peek; |
| 22 | |
| 23 | sub newscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/new(). { blessscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/bless(). {data => ''}, shiftscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/shift(). } |
| 24 | |
| 25 | |
| 26 | sub processing_instructionscip-perl cpan XML-SAX-ExpatXS 1.33 TestH/processing_instruction(). { |
| 27 | my ($self, $pi) = @_scip-perl cpan XML-SAX-ExpatXS 1.33 TestH/`@_`.; |
| 28 | #warn("PI:$pi->{Target}\n"); |
| 29 | #Dump($pi); |
| 30 | $self->{data} .= $pi->{Target} . '|'; |
| 31 | $self->{data} .= $pi->{Data}; |
| 32 | } |