Subject: | ->load_xml and XML::LibXML::InputCallback |
MIME-Version: | 1.0 |
X-Mailer: | MIME-tools 5.427 (Entity 5.427) |
X-RT-Original-Encoding: | utf-8 |
Content-Type: | multipart/mixed; boundary="----------=_1275901096-10886-141" |
Content-Length: | 0 |
Content-Type: | text/plain; charset="UTF-8" |
Content-Disposition: | inline |
Content-Transfer-Encoding: | binary |
Content-Length: | 514 |
I recently upgraded to XML::LibXML 1.70 and noticed the addition of the ->load_xml method.
When using this in conjunction with the `location` parameter to load an external file it seems to
ignore the InputCallback that was previously working fine with the ->parse_file method.
I have attached a short test case to this e-mail. When the file is read in with ->parse_file a
warning is generated in the InputCallback, however the warning is not triggered with -
Show quoted text
>load_xml. Should it be, or am I missing something?
Subject: | testcase.pl |
MIME-Version: | 1.0 |
Content-Type: | text/x-perl-script; name="testcase.pl" |
X-Mailer: | MIME-tools 5.427 (Entity 5.427) |
Content-Disposition: | inline; filename="testcase.pl" |
Content-Transfer-Encoding: | binary |
Content-Length: | 671 |
#!/usr/bin/perl -wT
use strict;
use warnings;
use XML::LibXML;
die 'This test case is for XML::LibXML v1.70'
unless $XML::LibXML::VERSION eq '1.70';
my $input_callbacks = XML::LibXML::InputCallback->new();
$input_callbacks->register_callbacks([
sub { 1 },
sub { warn 'Input callback used'; open my $fh, '<', shift; return $fh; },
sub { my $buffer; read(shift, $buffer, shift); return $buffer; },
sub { close shift },
]);
my $xml_parser = XML::LibXML->new();
$xml_parser->input_callbacks($input_callbacks);
warn "->parse_file:\n";
$xml_parser->parse_file('testcase.xml');
warn "->load_xml:\n";
$xml_parser->load_xml(location => 'testcase.xml');
Subject: | testcase.xml |
MIME-Version: | 1.0 |
Content-Type: | text/xml; name="testcase.xml" |
X-Mailer: | MIME-tools 5.427 (Entity 5.427) |
Content-Disposition: | inline; filename="testcase.xml" |
Content-Transfer-Encoding: | binary |
Content-Length: | 46 |
<?xml version="1.0" encoding="utf-8"?>
<foo/>