Subject: | ->load_xml and XML::LibXML::InputCallback |
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 |
#!/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 |
<?xml version="1.0" encoding="utf-8"?>
<foo/>