Subject: | Processing Instruction not working $data->{Target} and $data->{Data} wrong |
Well when trying to fetch processing instructions:
$data->{Target} holds the e.g. 'type="test/xsl" herf="my.xsl"' instead
of "xml-stylesheet"
$data->{Data} is empty!
Subject: | bug.t |
use Test;
BEGIN { plan tests => 2 }
use XML::SAX::PurePerl;
use XML::SAX::PurePerl::DebugHandler;
use XML::SAX::ParserFactory;
my $value;
{
local $/ = undef;
open(IN,"<testfiles/03c.xml");
$value = <IN>;
close(IN);
}
my $parser = XML::SAX::ParserFactory->parser(Handler => new My::SAXFilter());
$parser->parse_string($value);
package My::SAXFilter;
use base qw(XML::SAX::Base);
sub processing_instruction {
my $this = shift;
my $data = shift;
main::ok($data->{Target},"xml-stylesheet");
main::ok($data->{Data},"type=\"text/xsl\" href=\"processorinxml/base.xsl\"");
}
Subject: | patch.txt |
--- SAX/PurePerl.pm 2006-04-24 01:20:09.000000000 +0200
+++ SAX/PurePerl.pm.tom 2006-05-09 23:55:42.000000000 +0200
@@ -624,28 +624,31 @@
my ($target, $data);
$target = $self->Name($reader) ||
$self->parser_error("PI has no target", $reader);
+
if ($self->skip_whitespace($reader)) {
- $target = '';
+ my $tdata = '';
while (1) {
my $data = $reader->data;
$self->parser_error("End of data seen while looking for close PI marker", $reader)
unless length($data);
if ($data =~ /^(.*?)\?>/s) {
- $target .= $1;
+ $tdata .= $1;
$reader->move_along(length($1) + 2);
last;
}
else {
- $target .= $data;
+ $tdata .= $data;
$reader->move_along(length($data));
}
}
+ $data = $tdata;
}
else {
my $data = $reader->data(2);
$data =~ /^\?>/ or $self->parser_error("PI closing sequence not found", $reader);
$reader->move_along(2);
}
+
$self->processing_instruction({ Target => $target, Data => $data });
return 1;