Subject: | [patch] Allow parser options to be specified |
This is pretty critical for downstream projects for security reasons. See suggested patch
below:
Thanks,
Yann
diff --git a/lib/XML/LibXML/Simple.pm b/lib/XML/LibXML/Simple.pm
index 6b1afcc..5994afa 100644
--- a/lib/XML/LibXML/Simple.pm
+++ b/lib/XML/LibXML/Simple.pm
@@ -25,7 +25,7 @@ use Data::Dumper; #to be removed
my %known_opts = map { ($_ => 1) }
qw(keyattr keeproot forcecontent contentkey noattr searchpath
forcearray grouptags nsexpand normalisespace normalizespace
- valueattr nsstrip);
+ valueattr nsstrip parseropts);
my @DefKeyAttr = qw(name key id);
my $DefContentKey = qq(content);
@@ -66,7 +66,8 @@ sub _get_xml($$)
$source = $self->default_data_source($opts) unless defined $source;
$source = \*STDIN if $source eq '-';
- my $parser = XML::LibXML->new;
+ my %parser_opts = %{ $self->{opts} || {} };
+ my $parser = XML::LibXML->new(%parser_opts);
my $xml
= UNIVERSAL::isa($source,'XML::LibXML::Document') ? $source