summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes12
-rw-r--r--LibXML.pm15
-rw-r--r--LibXML.pod2
-rw-r--r--LibXML.xs83
-rw-r--r--MANIFEST2
-rw-r--r--META.json4
-rw-r--r--META.yml2
-rw-r--r--docs/libxml.dbk50
-rw-r--r--lib/XML/LibXML/Attr.pod2
-rw-r--r--lib/XML/LibXML/AttributeHash.pm2
-rw-r--r--lib/XML/LibXML/Boolean.pm2
-rw-r--r--lib/XML/LibXML/CDATASection.pod2
-rw-r--r--lib/XML/LibXML/Comment.pod2
-rw-r--r--lib/XML/LibXML/Common.pm2
-rw-r--r--lib/XML/LibXML/Common.pod2
-rw-r--r--lib/XML/LibXML/DOM.pod2
-rw-r--r--lib/XML/LibXML/Devel.pm2
-rw-r--r--lib/XML/LibXML/Document.pod2
-rw-r--r--lib/XML/LibXML/DocumentFragment.pod2
-rw-r--r--lib/XML/LibXML/Dtd.pod2
-rw-r--r--lib/XML/LibXML/Element.pod2
-rw-r--r--lib/XML/LibXML/ErrNo.pm2
-rw-r--r--lib/XML/LibXML/ErrNo.pod2
-rw-r--r--lib/XML/LibXML/Error.pm2
-rw-r--r--lib/XML/LibXML/Error.pod2
-rw-r--r--lib/XML/LibXML/InputCallback.pod2
-rw-r--r--lib/XML/LibXML/Literal.pm2
-rw-r--r--lib/XML/LibXML/Namespace.pod2
-rw-r--r--lib/XML/LibXML/Node.pod4
-rw-r--r--lib/XML/LibXML/NodeList.pm2
-rw-r--r--lib/XML/LibXML/Number.pm2
-rw-r--r--lib/XML/LibXML/PI.pod2
-rw-r--r--lib/XML/LibXML/Parser.pod26
-rw-r--r--lib/XML/LibXML/Pattern.pod2
-rw-r--r--lib/XML/LibXML/Reader.pm2
-rw-r--r--lib/XML/LibXML/Reader.pod12
-rw-r--r--lib/XML/LibXML/RegExp.pod2
-rw-r--r--lib/XML/LibXML/RelaxNG.pod27
-rw-r--r--lib/XML/LibXML/SAX.pm2
-rw-r--r--lib/XML/LibXML/SAX.pod2
-rw-r--r--lib/XML/LibXML/SAX/Builder.pm2
-rw-r--r--lib/XML/LibXML/SAX/Builder.pod2
-rw-r--r--lib/XML/LibXML/SAX/Generator.pm2
-rw-r--r--lib/XML/LibXML/SAX/Parser.pm2
-rw-r--r--lib/XML/LibXML/Schema.pod23
-rw-r--r--lib/XML/LibXML/Text.pod2
-rw-r--r--lib/XML/LibXML/XPathContext.pm2
-rw-r--r--lib/XML/LibXML/XPathContext.pod2
-rw-r--r--lib/XML/LibXML/XPathExpression.pod2
-rw-r--r--t/00-report-prereqs.t1
-rw-r--r--t/02parse.t6
-rw-r--r--t/13dtd.t2
-rw-r--r--t/17callbacks.t2
-rw-r--r--t/18docfree.t3
-rw-r--r--t/25relaxng.t32
-rw-r--r--t/26schema.t23
-rw-r--r--t/35huge_mode.t5
-rw-r--r--t/40reader.t1
-rw-r--r--t/43options.t21
-rw-r--r--t/48_SAX_Builder_rt_91433.t3
-rw-r--r--t/48_rt123379_setNamespace.t8
-rw-r--r--t/48_rt93429_recover_2_in_html_parsing.t1
-rw-r--r--t/62overload.t12
-rw-r--r--t/91unique_key.t1
-rw-r--r--test/relaxng/net.rng12
-rw-r--r--test/schema/net.xsd4
66 files changed, 337 insertions, 134 deletions
diff --git a/Changes b/Changes
index aa08048..e06087f 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,17 @@
Revision history for Perl extension XML::LibXML
+2.0202 2020-01-13
+ - Disable loading external DTDs or external entities by default
+ - Thanks to Tim Retout
+ - Docs: Noting that HTTPS doesn't work for schema-loading either.
+ - Thanks to Jason McIntosh
+ - Allow to parse RelaxNG without accessing network
+ - Thanks to PALI
+ - Allow to parse XML Schema without accessing network
+ - Thanks to PALI
+ - Add Test-Count assertion count checking using
+ https://metacpan.org/pod/Code::TidyAll::Plugin::TestCount
+
2.0201 2019-05-25
- Set MIN_PERL_VERSION to 5.8.1.
- Alien::Libxml2 Makefile.PL cleanups.
diff --git a/LibXML.pm b/LibXML.pm
index 37ac162..b31d365 100644
--- a/LibXML.pm
+++ b/LibXML.pm
@@ -29,7 +29,7 @@ use XML::LibXML::XPathContext;
use IO::Handle; # for FH reads called as methods
BEGIN {
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
$ABI_VERSION = 2;
require Exporter;
require DynaLoader;
@@ -261,7 +261,7 @@ use constant {
HTML_PARSE_NOERROR => (1<<5), # suppress error reports
};
-$XML_LIBXML_PARSE_DEFAULTS = ( XML_PARSE_NODICT | XML_PARSE_DTDLOAD | XML_PARSE_NOENT );
+$XML_LIBXML_PARSE_DEFAULTS = ( XML_PARSE_NODICT );
# this hash is made global so that applications can add names for new
# libxml2 parser flags as temporary workaround
@@ -366,6 +366,7 @@ sub new {
}
# parser flags
$opts{no_blanks} = !$opts{keep_blanks} if exists($opts{keep_blanks}) and !exists($opts{no_blanks});
+ $opts{load_ext_dtd} = $opts{expand_entities} if exists($opts{expand_entities}) and !exists($opts{load_ext_dtd});
for (keys %OUR_FLAGS) {
$self->{$OUR_FLAGS{$_}} = delete $opts{$_};
@@ -2078,13 +2079,13 @@ sub new {
my $self = undef;
if ( defined $args{location} ) {
- $self = $class->parse_location( $args{location} );
+ $self = $class->parse_location( $args{location}, XML::LibXML->_parser_options(\%args), $args{recover} );
}
elsif ( defined $args{string} ) {
- $self = $class->parse_buffer( $args{string} );
+ $self = $class->parse_buffer( $args{string}, XML::LibXML->_parser_options(\%args), $args{recover} );
}
elsif ( defined $args{DOM} ) {
- $self = $class->parse_document( $args{DOM} );
+ $self = $class->parse_document( $args{DOM}, XML::LibXML->_parser_options(\%args), $args{recover} );
}
return $self;
@@ -2102,10 +2103,10 @@ sub new {
my $self = undef;
if ( defined $args{location} ) {
- $self = $class->parse_location( $args{location} );
+ $self = $class->parse_location( $args{location}, XML::LibXML->_parser_options(\%args), $args{recover} );
}
elsif ( defined $args{string} ) {
- $self = $class->parse_buffer( $args{string} );
+ $self = $class->parse_buffer( $args{string}, XML::LibXML->_parser_options(\%args), $args{recover} );
}
return $self;
diff --git a/LibXML.pod b/LibXML.pod
index 686df1a..e5150f6 100644
--- a/LibXML.pod
+++ b/LibXML.pod
@@ -507,7 +507,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/LibXML.xs b/LibXML.xs
index efca0b6..51bb3be 100644
--- a/LibXML.xs
+++ b/LibXML.xs
@@ -7337,11 +7337,14 @@ DESTROY( self )
xmlRelaxNGPtr
-parse_location( self, url )
+parse_location( self, url, parser_options = 0, recover = FALSE )
char * url
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7357,20 +7360,33 @@ parse_location( self, url )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlRelaxNGPtr
-parse_buffer( self, perlstring )
+parse_buffer( self, perlstring, parser_options = 0, recover = FALSE )
SV * perlstring
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
char * string = NULL;
STRLEN len = 0;
PREINIT_SAVED_ERROR
@@ -7393,20 +7409,33 @@ parse_buffer( self, perlstring )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlRelaxNGPtr
-parse_document( self, doc )
+parse_document( self, doc, parser_options = 0, recover = FALSE )
xmlDocPtr doc
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::RelaxNG";
xmlRelaxNGParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7422,10 +7451,20 @@ parse_document( self, doc )
(xmlRelaxNGValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
#endif
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlRelaxNGParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlRelaxNGFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
@@ -7487,11 +7526,14 @@ DESTROY( self )
xmlSchemaPtr
-parse_location( self, url )
+parse_location( self, url, parser_options = 0, recover = FALSE )
char * url
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::Schema";
xmlSchemaParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
PREINIT_SAVED_ERROR
CODE:
INIT_ERROR_HANDLER;
@@ -7509,20 +7551,32 @@ parse_location( self, url )
(xmlSchemaValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlSchemaParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlSchemaFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
xmlSchemaPtr
-parse_buffer( self, perlstring )
+parse_buffer( self, perlstring, parser_options = 0, recover = FALSE )
SV * perlstring
+ int parser_options
+ bool recover
PREINIT:
const char * CLASS = "XML::LibXML::Schema";
xmlSchemaParserCtxtPtr rngctxt = NULL;
+ xmlExternalEntityLoader old_ext_ent_loader = NULL;
char * string = NULL;
STRLEN len = 0;
PREINIT_SAVED_ERROR
@@ -7547,10 +7601,19 @@ parse_buffer( self, perlstring )
(xmlSchemaValidityWarningFunc)LibXML_error_handler_ctx,
saved_error );
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) ) {
+ old_ext_ent_loader = xmlGetExternalEntityLoader();
+ xmlSetExternalEntityLoader( xmlNoNetExternalEntityLoader );
+ }
+
RETVAL = xmlSchemaParse( rngctxt );
+
+ if ( EXTERNAL_ENTITY_LOADER_FUNC == NULL && (parser_options & XML_PARSE_NONET) )
+ xmlSetExternalEntityLoader( (xmlExternalEntityLoader)old_ext_ent_loader );
+
xmlSchemaFreeParserCtxt( rngctxt );
CLEANUP_ERROR_HANDLER;
- REPORT_ERROR((RETVAL == NULL) ? 0 : 1);
+ REPORT_ERROR((RETVAL == NULL) ? 0 : recover);
OUTPUT:
RETVAL
diff --git a/MANIFEST b/MANIFEST
index 386a969..f3ba579 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -203,10 +203,12 @@ test/relaxng/demo2.rng
test/relaxng/demo3.rng
test/relaxng/demo4.rng
test/relaxng/invaliddemo.xml
+test/relaxng/net.rng
test/relaxng/schema.rng
test/schema/badschema.xsd
test/schema/demo.xml
test/schema/invaliddemo.xml
+test/schema/net.xsd
test/schema/schema.xsd
test/textReader/countries.xml
test/xinclude/entity.txt
diff --git a/META.json b/META.json
index baee45c..a2002e5 100644
--- a/META.json
+++ b/META.json
@@ -96,6 +96,6 @@
"web" : "https://github.com/shlomif/perl-XML-LibXML"
}
},
- "version" : "2.0201",
- "x_serialization_backend" : "JSON::PP version 2.97001"
+ "version" : "2.0202",
+ "x_serialization_backend" : "JSON::PP version 4.02"
}
diff --git a/META.yml b/META.yml
index 252dbab..e27da80 100644
--- a/META.yml
+++ b/META.yml
@@ -68,5 +68,5 @@ requires:
warnings: '0'
resources:
repository: https://github.com/shlomif/perl-XML-LibXML.git
-version: '2.0201'
+version: '2.0202'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/docs/libxml.dbk b/docs/libxml.dbk
index 8138bce..d572b73 100644
--- a/docs/libxml.dbk
+++ b/docs/libxml.dbk
@@ -22,7 +22,7 @@
</authorgroup>
- <edition>2.0201</edition>
+ <edition>2.0202</edition>
<copyright>
<year>2001-2007</year>
<holder>AxKit.com Ltd</holder>
@@ -1126,7 +1126,7 @@ $dom = $parser-&gt;load_xml(...);
</funcsynopsisinfo>
</funcsynopsis>
<para>This function is available since XML::LibXML 1.70. It provides easy to use interface to the XML parser that parses
- given file (or URL), string, or input stream
+ given file (or non-HTTPS URL), string, or input stream
to a DOM tree. The arguments
can be passed in a HASH reference
or as name => value pairs.
@@ -1143,6 +1143,11 @@ $dom = $parser-&gt;load_xml(...);
and <xref linkend="parser-options"/>
for more information.
</para>
+ <para>Note that, due to a limitation in the underlying libxml2
+ library, this call does not recognize HTTPS-based URLs. (It
+ will treat an HTTPS URL as a filename, likely throwing a "No such
+ file or directory" exception.)
+ </para>
</listitem>
</varlistentry>
<varlistentry>
@@ -1269,10 +1274,11 @@ $dom = $parser-&gt;load_html(...);
</funcsynopsis>
<para>This function parses an XML document from a file or network;
- $xmlfilename can be either a filename or an URL.
+ $xmlfilename can be either a filename or a (non-HTTPS) URL.
Note that for parsing files, this function is the fastest choice,
about 6-8 times faster then parse_fh().
</para>
+
</listitem>
</varlistentry>
@@ -1319,7 +1325,7 @@ my $doc = $parser-&gt;parse_string(\$xmlstring, $baseuri);
</funcsynopsis>
<para>Similar to parse_file() but parses HTML (strict) documents;
- $htmlfile can be filename or URL.
+ $htmlfile can be filename or (non-HTTPS) URL.
</para>
<para>An optional second argument can be
used to pass some options to the HTML
@@ -3246,7 +3252,7 @@ my $dtd = $document-&gt;createInternalSubset( "foo", "-//FOO//DTD FOO 0.1//
</funcsynopsis>
<para>This will unbind the Child Node from its parent <function>$node</function>. The function returns the unbound node. If
- <function>oldNode</function> is not a child of the given Node the function will fail.</para>
+ <function>$childnode</function> is not a child of the given Node the function will fail.</para>
</listitem>
</varlistentry>
@@ -5780,16 +5786,19 @@ $doc = XML::LibXML-&gt;new-&gt;parse_file($url);</programlisting>
<listitem>
<funcsynopsis>
- <funcsynopsisinfo>$rngschema = XML::LibXML::RelaxNG-&gt;new( location =&gt; $filename_or_url );
-$rngschema = XML::LibXML::RelaxNG-&gt;new( string =&gt; $xmlschemastring );
-$rngschema = XML::LibXML::RelaxNG-&gt;new( DOM =&gt; $doc );</funcsynopsisinfo>
+ <funcsynopsisinfo>$rngschema = XML::LibXML::RelaxNG-&gt;new( location =&gt; $filename_or_url, no_network =&gt; 1 );
+$rngschema = XML::LibXML::RelaxNG-&gt;new( string =&gt; $xmlschemastring, no_network =&gt; 1 );
+$rngschema = XML::LibXML::RelaxNG-&gt;new( DOM =&gt; $doc, no_network =&gt; 1 );</funcsynopsisinfo>
</funcsynopsis>
- <para>The constructor of XML::LibXML::RelaxNG may get called with either one of three parameters. The parameter tells the class from which
- source it should generate a validation schema. It is important, that each schema only have a single source.</para>
+ <para>The constructor of XML::LibXML::RelaxNG needs to be called with list of parameters. At least location, string or DOM parameter is required to
+ specify source of schema. Optional parameter no_network set to 1 cause that parser would not access network and optional parameter recover
+ set 1 cause that parser would not call die() on errors.</para>
+
+ <para>It is important, that each schema only have a single source.</para>
<para>The location parameter allows one to parse a schema
- from the filesystem or a URL.</para>
+ from the filesystem or a (non-HTTPS) URL.</para>
<para>The string parameter will parse the schema from the given XML string.</para>
@@ -5845,15 +5854,18 @@ $doc = XML::LibXML-&gt;new-&gt;parse_file($url);</programlisting>
<listitem>
<funcsynopsis>
- <funcsynopsisinfo>$xmlschema = XML::LibXML::Schema-&gt;new( location =&gt; $filename_or_url );
-$xmlschema = XML::LibXML::Schema-&gt;new( string =&gt; $xmlschemastring );</funcsynopsisinfo>
+ <funcsynopsisinfo>$xmlschema = XML::LibXML::Schema-&gt;new( location =&gt; $filename_or_url, no_network =&gt; 1 );
+$xmlschema = XML::LibXML::Schema-&gt;new( string =&gt; $xmlschemastring, no_network =&gt; 1 );</funcsynopsisinfo>
</funcsynopsis>
- <para>The constructor of XML::LibXML::Schema may get called with either one of two parameters. The parameter tells the class from which
- source it should generate a validation schema. It is important, that each schema only have a single source.</para>
+ <para>The constructor of XML::LibXML::Schema needs to be called with list of parameters. At least location or string parameter is required to
+ specify source of schema. Optional parameter no_network set to 1 cause that parser would not access network and optional parameter recover
+ set 1 cause that parser would not call die() on errors.</para>
+
+ <para>It is important, that each schema only have a single source.</para>
<para>The location parameter allows one to parse a schema
- from the filesystem or a URL.</para>
+ from the filesystem or a (non-HTTPS) URL.</para>
<para>The string parameter will parse the schema from the given XML string.</para>
@@ -6322,7 +6334,7 @@ sub processNode {
<varlistentry>
<term>location</term>
<listitem>
- <para>Read XML from a local file or URL.</para>
+ <para>Read XML from a local file or (non-HTTPS) URL.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -6367,7 +6379,7 @@ sub processNode {
<term>RelaxNG => $rng_schema</term>
<listitem>
<para>can be used to pass either a <xref linkend="XML-LibXML-RelaxNG"/>
- object or a filename or URL of a RelaxNG schema to the
+ object or a filename or (non-HTTPS) URL of a RelaxNG schema to the
constructor. The schema is then used to validate the
document as it is processed.</para>
</listitem>
@@ -6376,7 +6388,7 @@ sub processNode {
<term>Schema => $xsd_schema</term>
<listitem>
<para>can be used to pass either a <xref linkend="XML-LibXML-Schema"/>
- object or a filename or URL of a W3C XSD schema to the
+ object or a filename or (non-HTTPS) URL of a W3C XSD schema to the
constructor. The schema is then used to validate the
document as it is processed.</para>
</listitem>
diff --git a/lib/XML/LibXML/Attr.pod b/lib/XML/LibXML/Attr.pod
index 6735393..8475146 100644
--- a/lib/XML/LibXML/Attr.pod
+++ b/lib/XML/LibXML/Attr.pod
@@ -121,7 +121,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/AttributeHash.pm b/lib/XML/LibXML/AttributeHash.pm
index e2f23ac..4610ab3 100644
--- a/lib/XML/LibXML/AttributeHash.pm
+++ b/lib/XML/LibXML/AttributeHash.pm
@@ -7,7 +7,7 @@ use Tie::Hash;
our @ISA = qw/Tie::Hash/;
use vars qw($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
BEGIN
{
diff --git a/lib/XML/LibXML/Boolean.pm b/lib/XML/LibXML/Boolean.pm
index 7a43d55..394e4fd 100644
--- a/lib/XML/LibXML/Boolean.pm
+++ b/lib/XML/LibXML/Boolean.pm
@@ -16,7 +16,7 @@ use warnings;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use overload
'""' => \&value,
diff --git a/lib/XML/LibXML/CDATASection.pod b/lib/XML/LibXML/CDATASection.pod
index 3d898c7..262ac5d 100644
--- a/lib/XML/LibXML/CDATASection.pod
+++ b/lib/XML/LibXML/CDATASection.pod
@@ -45,7 +45,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Comment.pod b/lib/XML/LibXML/Comment.pod
index 610b6b6..b6d538c 100644
--- a/lib/XML/LibXML/Comment.pod
+++ b/lib/XML/LibXML/Comment.pod
@@ -46,7 +46,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Common.pm b/lib/XML/LibXML/Common.pm
index 423e6f4..4d9e367 100644
--- a/lib/XML/LibXML/Common.pm
+++ b/lib/XML/LibXML/Common.pm
@@ -24,7 +24,7 @@ use vars qw( @ISA $VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use XML::LibXML qw(:libxml);
diff --git a/lib/XML/LibXML/Common.pod b/lib/XML/LibXML/Common.pod
index 6b64b42..68ac16c 100644
--- a/lib/XML/LibXML/Common.pod
+++ b/lib/XML/LibXML/Common.pod
@@ -116,7 +116,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/DOM.pod b/lib/XML/LibXML/DOM.pod
index 4e0db21..e417a0c 100644
--- a/lib/XML/LibXML/DOM.pod
+++ b/lib/XML/LibXML/DOM.pod
@@ -129,7 +129,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Devel.pm b/lib/XML/LibXML/Devel.pm
index 36007d9..9f8dec1 100644
--- a/lib/XML/LibXML/Devel.pm
+++ b/lib/XML/LibXML/Devel.pm
@@ -12,7 +12,7 @@ use warnings;
use XML::LibXML;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use 5.008_000;
diff --git a/lib/XML/LibXML/Document.pod b/lib/XML/LibXML/Document.pod
index 1c0e255..8b415d1 100644
--- a/lib/XML/LibXML/Document.pod
+++ b/lib/XML/LibXML/Document.pod
@@ -683,7 +683,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/DocumentFragment.pod b/lib/XML/LibXML/DocumentFragment.pod
index a0edfd7..8f42fd3 100644
--- a/lib/XML/LibXML/DocumentFragment.pod
+++ b/lib/XML/LibXML/DocumentFragment.pod
@@ -27,7 +27,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Dtd.pod b/lib/XML/LibXML/Dtd.pod
index 9851970..351944a 100644
--- a/lib/XML/LibXML/Dtd.pod
+++ b/lib/XML/LibXML/Dtd.pod
@@ -89,7 +89,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Element.pod b/lib/XML/LibXML/Element.pod
index 023be0f..0fbe122 100644
--- a/lib/XML/LibXML/Element.pod
+++ b/lib/XML/LibXML/Element.pod
@@ -382,7 +382,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/ErrNo.pm b/lib/XML/LibXML/ErrNo.pm
index 6fc32f5..e3c5b84 100644
--- a/lib/XML/LibXML/ErrNo.pm
+++ b/lib/XML/LibXML/ErrNo.pm
@@ -14,7 +14,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use constant ERR_OK => 0;
use constant ERR_INTERNAL_ERROR => 1;
diff --git a/lib/XML/LibXML/ErrNo.pod b/lib/XML/LibXML/ErrNo.pod
index 1919fa5..575a285 100644
--- a/lib/XML/LibXML/ErrNo.pod
+++ b/lib/XML/LibXML/ErrNo.pod
@@ -17,7 +17,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Error.pm b/lib/XML/LibXML/Error.pm
index dfe235a..f6a69a9 100644
--- a/lib/XML/LibXML/Error.pm
+++ b/lib/XML/LibXML/Error.pm
@@ -29,7 +29,7 @@ use overload
fallback => 1;
$WARNINGS = 0; # 0: suppress, 1: report via warn, 2: report via die
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use constant XML_ERR_NONE => 0;
use constant XML_ERR_WARNING => 1; # A simple warning
diff --git a/lib/XML/LibXML/Error.pod b/lib/XML/LibXML/Error.pod
index aaf7063..421dd82 100644
--- a/lib/XML/LibXML/Error.pod
+++ b/lib/XML/LibXML/Error.pod
@@ -244,7 +244,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/InputCallback.pod b/lib/XML/LibXML/InputCallback.pod
index 66e0c4a..0ed4519 100644
--- a/lib/XML/LibXML/InputCallback.pod
+++ b/lib/XML/LibXML/InputCallback.pod
@@ -280,7 +280,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Literal.pm b/lib/XML/LibXML/Literal.pm
index 44e2194..86da094 100644
--- a/lib/XML/LibXML/Literal.pm
+++ b/lib/XML/LibXML/Literal.pm
@@ -16,7 +16,7 @@ use strict;
use warnings;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use overload
'""' => \&value,
diff --git a/lib/XML/LibXML/Namespace.pod b/lib/XML/LibXML/Namespace.pod
index adc88a8..e444577 100644
--- a/lib/XML/LibXML/Namespace.pod
+++ b/lib/XML/LibXML/Namespace.pod
@@ -141,7 +141,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Node.pod b/lib/XML/LibXML/Node.pod
index cfb0bfa..84ef18c 100644
--- a/lib/XML/LibXML/Node.pod
+++ b/lib/XML/LibXML/Node.pod
@@ -174,7 +174,7 @@ stripped from the context it is and inserted into a (hidden) document-fragment.
$childnode = $node->removeChild( $childnode );
-This will unbind the Child Node from its parent C<<<<<< $node >>>>>>. The function returns the unbound node. If C<<<<<< oldNode >>>>>> is not a child of the given Node the function will fail.
+This will unbind the Child Node from its parent C<<<<<< $node >>>>>>. The function returns the unbound node. If C<<<<<< $childnode >>>>>> is not a child of the given Node the function will fail.
=item replaceChild
@@ -763,7 +763,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/NodeList.pm b/lib/XML/LibXML/NodeList.pm
index 3c896d2..d2d0bc2 100644
--- a/lib/XML/LibXML/NodeList.pm
+++ b/lib/XML/LibXML/NodeList.pm
@@ -17,7 +17,7 @@ use XML::LibXML::Literal;
use XML::LibXML::Number;
use vars qw($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use overload
'""' => \&to_literal,
diff --git a/lib/XML/LibXML/Number.pm b/lib/XML/LibXML/Number.pm
index 49f740e..63b72ee 100644
--- a/lib/XML/LibXML/Number.pm
+++ b/lib/XML/LibXML/Number.pm
@@ -14,7 +14,7 @@ use strict;
use warnings;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use overload
'""' => \&value,
diff --git a/lib/XML/LibXML/PI.pod b/lib/XML/LibXML/PI.pod
index 50ea4f4..1ef5c21 100644
--- a/lib/XML/LibXML/PI.pod
+++ b/lib/XML/LibXML/PI.pod
@@ -74,7 +74,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Parser.pod b/lib/XML/LibXML/Parser.pod
index d20382f..c91553d 100644
--- a/lib/XML/LibXML/Parser.pod
+++ b/lib/XML/LibXML/Parser.pod
@@ -174,13 +174,17 @@ eval{} block
This function is available since XML::LibXML 1.70. It provides easy to use
-interface to the XML parser that parses given file (or URL), string, or input
-stream to a DOM tree. The arguments can be passed in a HASH reference or as
-name => value pairs. The function can be called as a class method or an object
-method. In both cases it internally creates a new parser instance passing the
-specified parser options; if called as an object method, it clones the original
-parser (preserving its settings) and additionally applies the specified options
-to the new parser. See the constructor C<<<<<< new >>>>>> and L<<<<<< Parser Options >>>>>> for more information.
+interface to the XML parser that parses given file (or non-HTTPS URL), string,
+or input stream to a DOM tree. The arguments can be passed in a HASH reference
+or as name => value pairs. The function can be called as a class method or an
+object method. In both cases it internally creates a new parser instance
+passing the specified parser options; if called as an object method, it clones
+the original parser (preserving its settings) and additionally applies the
+specified options to the new parser. See the constructor C<<<<<< new >>>>>> and L<<<<<< Parser Options >>>>>> for more information.
+
+Note that, due to a limitation in the underlying libxml2 library, this call
+does not recognize HTTPS-based URLs. (It will treat an HTTPS URL as a filename,
+likely throwing a "No such file or directory" exception.)
=item load_html
@@ -269,8 +273,8 @@ This is an alias to process_xincludes, but through a JAVA like function name.
$doc = $parser->parse_file( $xmlfilename );
This function parses an XML document from a file or network; $xmlfilename can
-be either a filename or an URL. Note that for parsing files, this function is
-the fastest choice, about 6-8 times faster then parse_fh().
+be either a filename or a (non-HTTPS) URL. Note that for parsing files, this
+function is the fastest choice, about 6-8 times faster then parse_fh().
=item parse_fh
@@ -308,7 +312,7 @@ function.
$doc = $parser->parse_html_file( $htmlfile, \%opts );
Similar to parse_file() but parses HTML (strict) documents; $htmlfile can be
-filename or URL.
+filename or (non-HTTPS) URL.
An optional second argument can be used to pass some options to the HTML parser
as a HASH reference. See options labeled with HTML in L<<<<<< Parser Options >>>>>>.
@@ -984,7 +988,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Pattern.pod b/lib/XML/LibXML/Pattern.pod
index 7eebfff..33be085 100644
--- a/lib/XML/LibXML/Pattern.pod
+++ b/lib/XML/LibXML/Pattern.pod
@@ -94,7 +94,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Reader.pm b/lib/XML/LibXML/Reader.pm
index 8856f57..00b249c 100644
--- a/lib/XML/LibXML/Reader.pm
+++ b/lib/XML/LibXML/Reader.pm
@@ -14,7 +14,7 @@ use strict;
use warnings;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use 5.008_000;
diff --git a/lib/XML/LibXML/Reader.pod b/lib/XML/LibXML/Reader.pod
index 1745e26..390e1ca 100644
--- a/lib/XML/LibXML/Reader.pod
+++ b/lib/XML/LibXML/Reader.pod
@@ -90,7 +90,7 @@ where ... are (optional) reader options described below in L<<<<<< Reader option
=item location
-Read XML from a local file or URL.
+Read XML from a local file or (non-HTTPS) URL.
=item string
@@ -129,14 +129,14 @@ override document encoding.
=item RelaxNG => $rng_schema
-can be used to pass either a L<<<<<< XML::LibXML::RelaxNG >>>>>> object or a filename or URL of a RelaxNG schema to the constructor. The schema
-is then used to validate the document as it is processed.
+can be used to pass either a L<<<<<< XML::LibXML::RelaxNG >>>>>> object or a filename or (non-HTTPS) URL of a RelaxNG schema to the constructor.
+The schema is then used to validate the document as it is processed.
=item Schema => $xsd_schema
-can be used to pass either a L<<<<<< XML::LibXML::Schema >>>>>> object or a filename or URL of a W3C XSD schema to the constructor. The schema
-is then used to validate the document as it is processed.
+can be used to pass either a L<<<<<< XML::LibXML::Schema >>>>>> object or a filename or (non-HTTPS) URL of a W3C XSD schema to the constructor.
+The schema is then used to validate the document as it is processed.
=item ...
@@ -657,7 +657,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/RegExp.pod b/lib/XML/LibXML/RegExp.pod
index 983ab92..9415c88 100644
--- a/lib/XML/LibXML/RegExp.pod
+++ b/lib/XML/LibXML/RegExp.pod
@@ -58,7 +58,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/RelaxNG.pod b/lib/XML/LibXML/RelaxNG.pod
index dee2a0e..399ed05 100644
--- a/lib/XML/LibXML/RelaxNG.pod
+++ b/lib/XML/LibXML/RelaxNG.pod
@@ -9,9 +9,9 @@ XML::LibXML::RelaxNG - RelaxNG Schema Validation
use XML::LibXML;
$doc = XML::LibXML->new->parse_file($url);
- $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url );
- $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring );
- $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc );
+ $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url, no_network => 1 );
+ $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring, no_network => 1 );
+ $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc, no_network => 1 );
eval { $rngschema->validate( $doc ); };
=head1 DESCRIPTION
@@ -27,17 +27,20 @@ validation.
=item new
- $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url );
- $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring );
- $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc );
+ $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url, no_network => 1 );
+ $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring, no_network => 1 );
+ $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc, no_network => 1 );
-The constructor of XML::LibXML::RelaxNG may get called with either one of three
-parameters. The parameter tells the class from which source it should generate
-a validation schema. It is important, that each schema only have a single
-source.
+The constructor of XML::LibXML::RelaxNG needs to be called with list of
+parameters. At least location, string or DOM parameter is required to specify
+source of schema. Optional parameter no_network set to 1 cause that parser
+would not access network and optional parameter recover set 1 cause that parser
+would not call die() on errors.
+
+It is important, that each schema only have a single source.
The location parameter allows one to parse a schema from the filesystem or a
-URL.
+(non-HTTPS) URL.
The string parameter will parse the schema from the given XML string.
@@ -70,7 +73,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/SAX.pm b/lib/XML/LibXML/SAX.pm
index 3c685bc..f38bed7 100644
--- a/lib/XML/LibXML/SAX.pm
+++ b/lib/XML/LibXML/SAX.pm
@@ -14,7 +14,7 @@ use warnings;
use vars qw($VERSION @ISA);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
use XML::LibXML;
use XML::SAX::Base;
diff --git a/lib/XML/LibXML/SAX.pod b/lib/XML/LibXML/SAX.pod
index 4f848db..2b29625 100644
--- a/lib/XML/LibXML/SAX.pod
+++ b/lib/XML/LibXML/SAX.pod
@@ -47,7 +47,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/SAX/Builder.pm b/lib/XML/LibXML/SAX/Builder.pm
index fb5c51c..2f8758b 100644
--- a/lib/XML/LibXML/SAX/Builder.pm
+++ b/lib/XML/LibXML/SAX/Builder.pm
@@ -21,7 +21,7 @@ sub CLONE_SKIP {
return $XML::LibXML::__threads_shared ? 0 : 1;
}
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
sub new {
my $class = shift;
diff --git a/lib/XML/LibXML/SAX/Builder.pod b/lib/XML/LibXML/SAX/Builder.pod
index 4dd6b4b..bb4f628 100644
--- a/lib/XML/LibXML/SAX/Builder.pod
+++ b/lib/XML/LibXML/SAX/Builder.pod
@@ -38,7 +38,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/SAX/Generator.pm b/lib/XML/LibXML/SAX/Generator.pm
index 0ad3035..33aeed6 100644
--- a/lib/XML/LibXML/SAX/Generator.pm
+++ b/lib/XML/LibXML/SAX/Generator.pm
@@ -15,7 +15,7 @@ use warnings;
use XML::LibXML;
use vars qw ($VERSION);
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
sub CLONE_SKIP {
return $XML::LibXML::__threads_shared ? 0 : 1;
diff --git a/lib/XML/LibXML/SAX/Parser.pm b/lib/XML/LibXML/SAX/Parser.pm
index 3b1723f..c30bb84 100644
--- a/lib/XML/LibXML/SAX/Parser.pm
+++ b/lib/XML/LibXML/SAX/Parser.pm
@@ -18,7 +18,7 @@ use XML::LibXML::Common qw(:libxml);
use XML::SAX::Base;
use XML::SAX::DocumentLocator;
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
@ISA = ('XML::SAX::Base');
sub CLONE_SKIP {
diff --git a/lib/XML/LibXML/Schema.pod b/lib/XML/LibXML/Schema.pod
index 58185e8..bc115ee 100644
--- a/lib/XML/LibXML/Schema.pod
+++ b/lib/XML/LibXML/Schema.pod
@@ -9,8 +9,8 @@ XML::LibXML::Schema - XML Schema Validation
use XML::LibXML;
$doc = XML::LibXML->new->parse_file($url);
- $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url );
- $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring );
+ $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url, no_network => 1 );
+ $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring, no_network => 1 );
eval { $xmlschema->validate( $doc ); };
=head1 DESCRIPTION
@@ -27,16 +27,19 @@ validation. As of 2.6.32, libxml2 only supports decimal types up to 24 digits
=item new
- $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url );
- $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring );
+ $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url, no_network => 1 );
+ $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring, no_network => 1 );
-The constructor of XML::LibXML::Schema may get called with either one of two
-parameters. The parameter tells the class from which source it should generate
-a validation schema. It is important, that each schema only have a single
-source.
+The constructor of XML::LibXML::Schema needs to be called with list of
+parameters. At least location or string parameter is required to specify source
+of schema. Optional parameter no_network set to 1 cause that parser would not
+access network and optional parameter recover set 1 cause that parser would not
+call die() on errors.
+
+It is important, that each schema only have a single source.
The location parameter allows one to parse a schema from the filesystem or a
-URL.
+(non-HTTPS) URL.
The string parameter will parse the schema from the given XML string.
@@ -66,7 +69,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/Text.pod b/lib/XML/LibXML/Text.pod
index 89d9b7e..2a338d9 100644
--- a/lib/XML/LibXML/Text.pod
+++ b/lib/XML/LibXML/Text.pod
@@ -170,7 +170,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/XPathContext.pm b/lib/XML/LibXML/XPathContext.pm
index 8e6db87..6b32507 100644
--- a/lib/XML/LibXML/XPathContext.pm
+++ b/lib/XML/LibXML/XPathContext.pm
@@ -17,7 +17,7 @@ use Carp;
use XML::LibXML;
use XML::LibXML::NodeList;
-$VERSION = "2.0201"; # VERSION TEMPLATE: DO NOT CHANGE
+$VERSION = "2.0202"; # VERSION TEMPLATE: DO NOT CHANGE
# should LibXML XPath data types be used for simple objects
# when passing parameters to extension functions (default: no)
diff --git a/lib/XML/LibXML/XPathContext.pod b/lib/XML/LibXML/XPathContext.pod
index ec76860..7556bd7 100644
--- a/lib/XML/LibXML/XPathContext.pod
+++ b/lib/XML/LibXML/XPathContext.pod
@@ -362,7 +362,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/lib/XML/LibXML/XPathExpression.pod b/lib/XML/LibXML/XPathExpression.pod
index 490e9be..6be16e9 100644
--- a/lib/XML/LibXML/XPathExpression.pod
+++ b/lib/XML/LibXML/XPathExpression.pod
@@ -52,7 +52,7 @@ Petr Pajas
=head1 VERSION
-2.0201
+2.0202
=head1 COPYRIGHT
diff --git a/t/00-report-prereqs.t b/t/00-report-prereqs.t
index c72183a..259894e 100644
--- a/t/00-report-prereqs.t
+++ b/t/00-report-prereqs.t
@@ -188,6 +188,7 @@ if ( @dep_errors ) {
);
}
+# TEST
pass;
# vim: ts=4 sts=4 sw=4 et:
diff --git a/t/02parse.t b/t/02parse.t
index 929654d..b111507 100644
--- a/t/02parse.t
+++ b/t/02parse.t
@@ -25,6 +25,8 @@ use constant XML_DECL => "<?xml version=\"1.0\"?>\n";
use Errno qw(ENOENT);
+# TEST*533
+
##
# test values
my @goodWFStrings = (
@@ -720,7 +722,7 @@ my $badXInclude = q{
my %badstrings = (
SIMPLE => '<?xml version="1.0"?>'."\n<A/>\n",
);
- my $parser = XML::LibXML->new;
+ my $parser = XML::LibXML->new(expand_entities => 1);
$parser->validation(1);
my $doc;
@@ -745,7 +747,7 @@ EOXML
<bar/>
EOXML
- my $parser = XML::LibXML->new;
+ my $parser = XML::LibXML->new(expand_entities => 1);
$parser->validation(1);
eval { $parser->parse_string( $badxml ); };
diff --git a/t/13dtd.t b/t/13dtd.t
index bd6b747..08c2fbb 100644
--- a/t/13dtd.t
+++ b/t/13dtd.t
@@ -69,7 +69,7 @@ ok($dtdstr, "DTD String read");
# TEST
ok ($@, '->validate throws an exception');
- my $parser = XML::LibXML->new();
+ my $parser = XML::LibXML->new(load_ext_dtd => 1);
# TEST
ok ($parser->validation(1), '->validation returns 1');
# this one is OK as it's well formed (no DTD)
diff --git a/t/17callbacks.t b/t/17callbacks.t
index dafaee0..e2d9859 100644
--- a/t/17callbacks.t
+++ b/t/17callbacks.t
@@ -276,7 +276,7 @@ $XML::LibXML::close_cb = $close1_global_counter->cb();
{
# tests if global callbacks are working
- my $parser = XML::LibXML->new();
+ my $parser = XML::LibXML->new(load_ext_dtd => 1);
# TEST
ok($parser, '$parser was init');
diff --git a/t/18docfree.t b/t/18docfree.t
index fb559d5..9a2cff6 100644
--- a/t/18docfree.t
+++ b/t/18docfree.t
@@ -9,5 +9,6 @@ use XML::LibXML;
$doc = XML::LibXML::Document->new();
}
# used to get "Attempt to free unreferenced scalar" here
-ok(1, 'docfree Out of scope is OK - no "Attempt to free unreferenced scalar"');
+# TEST
+pass('docfree Out of scope is OK - no "Attempt to free unreferenced scalar"');
diff --git a/t/25relaxng.t b/t/25relaxng.t
index dd579ee..93e6188 100644
--- a/t/25relaxng.t
+++ b/t/25relaxng.t
@@ -16,7 +16,7 @@ BEGIN {
use XML::LibXML;
if ( XML::LibXML::LIBXML_VERSION >= 20510 ) {
- plan tests => 13;
+ plan tests => 17;
}
else {
plan skip_all => 'Skip No RNG Support compiled';
@@ -32,6 +32,7 @@ my $badfile = "test/relaxng/badschema.rng";
my $validfile = "test/relaxng/demo.xml";
my $invalidfile = "test/relaxng/invaliddemo.xml";
my $demo4 = "test/relaxng/demo4.rng";
+my $netfile = "test/relaxng/net.rng";
print "# 1 parse schema from a file\n";
{
@@ -127,5 +128,34 @@ EOXML
}
+print "# 6 check that no_network => 1 works\n";
+{
+ my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) };
+ # TEST
+ like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
+ # TEST
+ ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' );
+}
+{
+ my $rng = eval { XML::LibXML::RelaxNG->new( string => <<'EOF', no_network => 1 ) };
+<?xml version="1.0" encoding="iso-8859-1"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <include href="http://example.com/xml.rng"/>
+ <start>
+ <ref name="include"/>
+ </start>
+ <define name="include">
+ <element name="include">
+ <text/>
+ </element>
+ </define>
+</grammar>
+EOF
+ # TEST
+ like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
+ # TEST
+ ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' );
+}
+
} # Version >= 20510 test
diff --git a/t/26schema.t b/t/26schema.t
index 90831ab..17f641e 100644
--- a/t/26schema.t
+++ b/t/26schema.t
@@ -15,7 +15,7 @@ use Test::More;
use XML::LibXML;
if ( XML::LibXML::LIBXML_VERSION >= 20510 ) {
- plan tests => 8;
+ plan tests => 12;
}
else {
plan skip_all => 'No Schema Support compiled.';
@@ -27,6 +27,7 @@ my $file = "test/schema/schema.xsd";
my $badfile = "test/schema/badschema.xsd";
my $validfile = "test/schema/demo.xml";
my $invalidfile = "test/schema/invaliddemo.xml";
+my $netfile = "test/schema/net.xsd";
# 1 parse schema from a file
@@ -112,3 +113,23 @@ EOF
is( $result, 0, 'validate() with element returns 0' );
}
+# 5 check that no_network => 1 works
+{
+ my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) };
+ # TEST
+ like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
+ # TEST
+ ok( !defined $schema, 'Schema from file location with external import and no_network => 1 is not loaded.' );
+}
+{
+ my $schema = eval { XML::LibXML::Schema->new( string => <<'EOF', no_network => 1 ) };
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:import namespace="http://example.com/namespace" schemaLocation="http://example.com/xml.xsd"/>
+</xsd:schema>
+EOF
+ # TEST
+ like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
+ # TEST
+ ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' );
+}
diff --git a/t/35huge_mode.t b/t/35huge_mode.t
index adf03da..1ccb334 100644
--- a/t/35huge_mode.t
+++ b/t/35huge_mode.t
@@ -49,11 +49,14 @@ my($parser, $doc);
$parser = XML::LibXML->new;
#$parser->set_option(huge => 0);
+# TEST
ok(!$parser->get_option('huge'), "huge mode disabled by default");
$doc = eval { $parser->parse_string($evil_xml); };
+# TEST
isnt("$@", "", "exception thrown during parse");
+# TEST
like($@, qr/entity.*loop/si, "exception refers to entity reference loop");
@@ -61,9 +64,11 @@ $parser = XML::LibXML->new;
$doc = eval { $parser->parse_string($benign_xml); };
+# TEST
is("$@", "", "no exception thrown during parse");
my $body = $doc->findvalue( '/lolz' );
+# TEST
is($body, 'haha', 'entity was parsed and expanded correctly');
exit;
diff --git a/t/40reader.t b/t/40reader.t
index 4b75b22..f08c2ab 100644
--- a/t/40reader.t
+++ b/t/40reader.t
@@ -19,6 +19,7 @@ BEGIN{
use_ok('XML::LibXML::Reader');
};
+# TEST*100
my $file = "test/textReader/countries.xml";
{
my $reader = XML::LibXML::Reader->new(location => $file, {expand_entities => 1});
diff --git a/t/43options.t b/t/43options.t
index 826f0ad..d46fe23 100644
--- a/t/43options.t
+++ b/t/43options.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 290;
+use Test::More tests => 291;
use XML::LibXML;
@@ -50,7 +50,7 @@ no_network
{
my $p = XML::LibXML->new();
for my $opt (@all) {
- my $ret = (($opt =~ /^(?:load_ext_dtd|expand_entities)$/) ? 1 : 0);
+ my $ret = 0;
# TEST*$all
ok(
($p->get_option($opt)||0) == $ret
@@ -110,18 +110,21 @@ no_network
ok( $p->get_option('recover') == 2, ' TODO : Add test name' );
# TEST
- ok( $p->expand_entities() == 1, ' TODO : Add test name' );
+ ok( $p->expand_entities() == 0, 'expand_entities should default to false' );
# TEST
- ok( $p->load_ext_dtd() == 1, ' TODO : Add test name' );
+ ok( $p->load_ext_dtd() == 0, 'load_ext_dtd should default to false' );
+ $p->load_ext_dtd(1);
+ # TEST
+ ok( $p->load_ext_dtd() == 1, 'load_ext_dtd should be true after being set to true' );
$p->load_ext_dtd(0);
+ $p->expand_entities(1);
# TEST
- ok( $p->load_ext_dtd() == 0, ' TODO : Add test name' );
- $p->expand_entities(0);
+ ok( $p->expand_entities() == 1, 'expand_entities should be true after being set to true' );
# TEST
- ok( $p->expand_entities() == 0, ' TODO : Add test name' );
- $p->expand_entities(1);
+ ok( $p->load_ext_dtd() == 1, 'load_ext_dtd should be true after expand_entities is set to true' );
+ $p->expand_entities(0);
# TEST
- ok( $p->expand_entities() == 1, ' TODO : Add test name' );
+ ok( $p->expand_entities() == 0, 'expand_entities should be false after being set to false' );
}
{
diff --git a/t/48_SAX_Builder_rt_91433.t b/t/48_SAX_Builder_rt_91433.t
index 3422d42..808c0ec 100644
--- a/t/48_SAX_Builder_rt_91433.t
+++ b/t/48_SAX_Builder_rt_91433.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
use warnings;
@@ -50,6 +50,7 @@ $parser->parse_string(<<'END_OF_XML');
</rdf:RDF></metadata></record></GetRecord></OAI-PMH>
END_OF_XML
+# TEST
eq_or_diff(
\@got_warnings,
[],
diff --git a/t/48_rt123379_setNamespace.t b/t/48_rt123379_setNamespace.t
index 45bf5e8..bf396f7 100644
--- a/t/48_rt123379_setNamespace.t
+++ b/t/48_rt123379_setNamespace.t
@@ -4,12 +4,20 @@ use warnings;
use XML::LibXML;
use Test::More tests => 8;
+# TEST
ok(my $doc = XML::LibXML::Document->new(), 'new document');
+# TEST
ok(my $elm = $doc->createElement('D:element'), 'create element');
+# TEST
ok($elm->setAttribute('xmlns:D', 'attribute'), 'set attribute');
$doc->setDocumentElement($elm); # XXX does not return true if successful
+# TEST
ok(my $str = $doc->toString(0), 'to string');
+# TEST
ok(my $par = XML::LibXML->new(), 'new parser');
+# TEST
ok( eval { $par->parse_string($str) } , 'parse string');
+# TEST
is($@, "", 'parse error');
+# TEST
like($str, qr{<D:element xmlns:D="attribute"/>}, 'xml element');
diff --git a/t/48_rt93429_recover_2_in_html_parsing.t b/t/48_rt93429_recover_2_in_html_parsing.t
index d684fa4..c1c06be 100644
--- a/t/48_rt93429_recover_2_in_html_parsing.t
+++ b/t/48_rt93429_recover_2_in_html_parsing.t
@@ -27,6 +27,7 @@ use XML::LibXML;
close($fh);
+ # TEST
is($buf, '', 'No warning emitted on load_html with recover => 2.');
}
diff --git a/t/62overload.t b/t/62overload.t
index 24ee7be..98b9032 100644
--- a/t/62overload.t
+++ b/t/62overload.t
@@ -16,23 +16,35 @@ $e2->setAttribute('attr' => 'value2');
my $h1 = \%{ $e1 };
my $h2 = \%{ $e2 };
+# TEST
isnt $h1,$h2, 'different references';
+# TEST
is $h1->{attr}, 'value1', 'affr for el 1';
+# TEST
is $h2->{attr}, 'value2', 'affr for el 2';
+# TEST
is "$e1", '<test1 attr="value1"/>', 'stringify for el 1';
+# TEST
is "$e2", '<test2 attr="value2"/>', 'stringify for el 2';
+# TEST
cmp_ok 0+$e1, '>', 1, 'num for el 1';
+# TEST
cmp_ok 0+$e2, '>', 1, 'num for el 2';
+# TEST
isnt 0+$e1,0+$e2, 'num for e1 and e2 differs';
my $e3 = $e1;
+# TEST
ok $e3 eq $e1, 'eq';
+# TEST
ok $e3 == $e1, '==';
+# TEST
ok $e1 ne $e2, 'ne';
+# TEST
ok $e1 != $e2, '!=';
diff --git a/t/91unique_key.t b/t/91unique_key.t
index 19ad9e5..fd5a0bb 100644
--- a/t/91unique_key.t
+++ b/t/91unique_key.t
@@ -23,6 +23,7 @@ my $foo = $doc->documentElement;
my @children_1 = $foo->childNodes;
my @children_2 = $foo->childNodes;
+# TEST
ok($children_1[0]->can('unique_key'), 'unique_key method available')
or exit -1;
diff --git a/test/relaxng/net.rng b/test/relaxng/net.rng
new file mode 100644
index 0000000..32f8571
--- /dev/null
+++ b/test/relaxng/net.rng
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <include href="http://example.com/xml.rng"/>
+ <start>
+ <ref name="include"/>
+ </start>
+ <define name="include">
+ <element name="include">
+ <text/>
+ </element>
+ </define>
+</grammar>
diff --git a/test/schema/net.xsd b/test/schema/net.xsd
new file mode 100644
index 0000000..21bb390
--- /dev/null
+++ b/test/schema/net.xsd
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:import namespace="http://example.com/namespace" schemaLocation="http://example.com/xml.xsd"/>
+</xsd:schema>