Imported Upstream version 2.0202 upstream/2.0202
authorDongHun Kwak <dh0128.kwak@samsung.com>
Sun, 24 Jul 2022 23:44:28 +0000 (08:44 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Sun, 24 Jul 2022 23:44:28 +0000 (08:44 +0900)
66 files changed:
Changes
LibXML.pm
LibXML.pod
LibXML.xs
MANIFEST
META.json
META.yml
docs/libxml.dbk
lib/XML/LibXML/Attr.pod
lib/XML/LibXML/AttributeHash.pm
lib/XML/LibXML/Boolean.pm
lib/XML/LibXML/CDATASection.pod
lib/XML/LibXML/Comment.pod
lib/XML/LibXML/Common.pm
lib/XML/LibXML/Common.pod
lib/XML/LibXML/DOM.pod
lib/XML/LibXML/Devel.pm
lib/XML/LibXML/Document.pod
lib/XML/LibXML/DocumentFragment.pod
lib/XML/LibXML/Dtd.pod
lib/XML/LibXML/Element.pod
lib/XML/LibXML/ErrNo.pm
lib/XML/LibXML/ErrNo.pod
lib/XML/LibXML/Error.pm
lib/XML/LibXML/Error.pod
lib/XML/LibXML/InputCallback.pod
lib/XML/LibXML/Literal.pm
lib/XML/LibXML/Namespace.pod
lib/XML/LibXML/Node.pod
lib/XML/LibXML/NodeList.pm
lib/XML/LibXML/Number.pm
lib/XML/LibXML/PI.pod
lib/XML/LibXML/Parser.pod
lib/XML/LibXML/Pattern.pod
lib/XML/LibXML/Reader.pm
lib/XML/LibXML/Reader.pod
lib/XML/LibXML/RegExp.pod
lib/XML/LibXML/RelaxNG.pod
lib/XML/LibXML/SAX.pm
lib/XML/LibXML/SAX.pod
lib/XML/LibXML/SAX/Builder.pm
lib/XML/LibXML/SAX/Builder.pod
lib/XML/LibXML/SAX/Generator.pm
lib/XML/LibXML/SAX/Parser.pm
lib/XML/LibXML/Schema.pod
lib/XML/LibXML/Text.pod
lib/XML/LibXML/XPathContext.pm
lib/XML/LibXML/XPathContext.pod
lib/XML/LibXML/XPathExpression.pod
t/00-report-prereqs.t
t/02parse.t
t/13dtd.t
t/17callbacks.t
t/18docfree.t
t/25relaxng.t
t/26schema.t
t/35huge_mode.t
t/40reader.t
t/43options.t
t/48_SAX_Builder_rt_91433.t
t/48_rt123379_setNamespace.t
t/48_rt93429_recover_2_in_html_parsing.t
t/62overload.t
t/91unique_key.t
test/relaxng/net.rng [new file with mode: 0644]
test/schema/net.xsd [new file with mode: 0644]

diff --git a/Changes b/Changes
index aa080487fac8618dcb4af7e724c2f2f87fa88316..e06087f6e7a92c8ba5f301dbdab42d39927129cd 100644 (file)
--- 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.
index 37ac162b12a6c5bb69ab25c52f5d027dd5219271..b31d365bd74a359b185739f7666b7ce1a3a42692 100644 (file)
--- 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;
index 686df1afc73ab2b46e12e28e9ab400f20fd11077..e5150f6c8f848184ec89fcc7568e110c18e09f2c 100644 (file)
@@ -507,7 +507,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index efca0b6a795f189e8133355116e73c6e392575c5..51bb3bebe10671510fffd3f1635175d65e76c776 100644 (file)
--- 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
 
index 386a969e130ca831847ce0ed2e85e981324edb23..f3ba579de5856ca33b3ca0b00489af2cd666bd42 100644 (file)
--- 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
index baee45c16cd5c1c44084bd899c6a66aff0e2f434..a2002e5a5a4fbe940707cf2b596e1e438ee2f254 100644 (file)
--- 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"
 }
index 252dbab0f0d4433d7a8f0d40d35985203e384766..e27da80ea9fe24b079e461874df7820362e8722c 100644 (file)
--- 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'
index 8138bce7d9dfd2e71ffbcc42ce386438b3ebc64e..d572b730b47a41cdda9abcc3840c1f25e35dad06 100644 (file)
@@ -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>
index 6735393a9191e1e02854fdc5ea8ef917fe4a1db4..8475146a4cb4a5d35741bf86938a07a65b4dc327 100644 (file)
@@ -121,7 +121,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index e2f23ac4a61ec2ac2fc886b6bc6245783ecea251..4610ab3eef3d7531a7738d1160cedf6180e84d4e 100644 (file)
@@ -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
 {
index 7a43d551c890f3d6224a4559419956d7d266d6bf..394e4fd87595b6497127488bdedee56d49ee1b9c 100644 (file)
@@ -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,
index 3d898c70c112e69b6c94850124187cdfd481494a..262ac5dfc41a328969e4cac2e95b38459e6551b7 100644 (file)
@@ -45,7 +45,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 610b6b6bceffc334900441005a847eccf0bc85e2..b6d538c76b6c0cd2088e3ddf39b706b1533ae388 100644 (file)
@@ -46,7 +46,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 423e6f4707298071802c4aac8f3e30472eb5e2ac..4d9e367f6094b760ee98ca236fa47db9681d5e98 100644 (file)
@@ -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);
 
index 6b64b42a8911595052dd0e588b02831d716fe5ff..68ac16cfc7192674b18872f191400193b02c9c72 100644 (file)
@@ -116,7 +116,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 4e0db219189f3734f5893ae831adf2932f6a204a..e417a0cacadefa7eca08410040abeb5f1fb0ede4 100644 (file)
@@ -129,7 +129,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 36007d91ce26ef4cc202460dfec7a4f187052716..9f8dec1fa672c29d837ac913d9ee17005b442fb6 100644 (file)
@@ -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;
 
index 1c0e25517bd26d6985f8d398e849bf7fed9f056d..8b415d1091f5964dab7f400023f02eac55f04746 100644 (file)
@@ -683,7 +683,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index a0edfd7c7120be909b43ad6288be1cbf813c9dcb..8f42fd3d095da6658b73154f57c5d79d979c2ec8 100644 (file)
@@ -27,7 +27,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 9851970712a19cfe8a1bdadc6c59c9b5916e427b..351944a9f28fe801af3c260dc44fe9397225f3c9 100644 (file)
@@ -89,7 +89,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 023be0f7fa30d9d8422762b2a736e0e0415bbb3a..0fbe12234554bf8ee8c594a7c60ac55509e89a82 100644 (file)
@@ -382,7 +382,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 6fc32f515861ecc32318f87c4def15c6cea54ecf..e3c5b84b5274b7e3d2c27f97c441de2a972cc69c 100644 (file)
@@ -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;
index 1919fa5fc3f2b0a257aa08be660018c44a389590..575a28519f81a415c810782ec0b42b8760cfca56 100644 (file)
@@ -17,7 +17,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index dfe235adb49a5380fd9c68331f19423181ed216c..f6a69a935d13bde75e6766aba059bb1115a6aa18 100644 (file)
@@ -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
index aaf70634139887458208437b083e9ba8efe6ba64..421dd827a3fc1749ff00af7ab53e59fc4bdf8658 100644 (file)
@@ -244,7 +244,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 66e0c4a1ee25f55a14ef8e06ff491144037017d0..0ed45197bdf45262a4a79db722d941ad628fc776 100644 (file)
@@ -280,7 +280,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 44e219435aecc3437992fc5ec7d58542de9772e5..86da0940eae27d2aec8842e4f5467a700f95d384 100644 (file)
@@ -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,
index adc88a8b9cff9f6e0f18dfc51b8826448a5bdb49..e444577a964b2c7d2ef1b2be5637755c036a113b 100644 (file)
@@ -141,7 +141,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index cfb0bfad4582f199bfd413241487bbac94540351..84ef18c29ed9ab8ff4a439f090a38cb0cc9fbf5c 100644 (file)
@@ -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
 
index 3c896d22ec62dd66104c911b33478afb0b544b02..d2d0bc23a3207e49668431f1af1e2aea49a5b678 100644 (file)
@@ -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,
index 49f740e5d919252a35eaa3441b7f51eb24d6252f..63b72eec45a6ecd6e61a587e2c8c93f7bfc2de64 100644 (file)
@@ -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,
index 50ea4f45d1ceabb5fe82e0938e2cb1e46ce5cda4..1ef5c21a49bc3e573b0a4f5da8bf48b22d9c6e62 100644 (file)
@@ -74,7 +74,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index d20382f87b49c1502051698199c7090d64f0c7b1..c91553d99089edbc4c3c2797291693c024bf7d5e 100644 (file)
@@ -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
 
index 7eebfff26ecfb1105440e9a2e2a6f65192c99177..33be085b58a5aff033550498c74b6bbf94a84dd9 100644 (file)
@@ -94,7 +94,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 8856f57cd0faea15ec1b7ecabef54034888d0c9e..00b249ce1b50bfec0aee7eff66f69c9548f2e2ed 100644 (file)
@@ -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;
 
index 1745e26e4c69ef739bd61a5b0120cf6f128adaa3..390e1ca0f6bf5d62192269e9f8f2c3e6915fa56a 100644 (file)
@@ -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
 
index 983ab92a072e2ca5f2fcc4c9dbbed80870d05f2a..9415c8819ed90f16343d8894efb1f8041857995a 100644 (file)
@@ -58,7 +58,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index dee2a0e01ca5b400d14fb2487c3a42f56def9644..399ed055025aba0e7b611112c4ecf374567c79df 100644 (file)
@@ -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
 
index 3c685bc0ec8bcac1d90882c4c61e43de04e4b807..f38bed7a8312b8d9b49ee39fc8e58bc0045de6af 100644 (file)
@@ -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;
index 4f848db54b325d05dfbbf63870d0ce169ae69267..2b2962533d731d56f1d9431f1010af2bb105c604 100644 (file)
@@ -47,7 +47,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index fb5c51cdfe620e69edf61785eea760345705feed..2f8758b4e04768860c7cc4648821027680b18564 100644 (file)
@@ -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;
index 4dd6b4be91cc5d5146859e021c76e8a4320ba481..bb4f6283dae441a4fb8bdcaa3a60dd584cd14435 100644 (file)
@@ -38,7 +38,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 0ad30358ba4c074b5dd4ce345b8037ecb48c42a1..33aeed687564e4f4932843a9d1b6f752501d84ad 100644 (file)
@@ -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;
index 3b1723f651b330701d84f26a76128a1186502825..c30bb842ba6f4280f558e634d80704c5736f8990 100644 (file)
@@ -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 {
index 58185e834df938931cb6e5e90e5bc8d43de5ec1d..bc115ee3a62a1790f833ea1a4d8519abc0f7ed60 100644 (file)
@@ -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
 
index 89d9b7e2a985b9dd461c8b502510dfdae742634f..2a338d9aa2624e6bd5f0f085f461b1474b6778cb 100644 (file)
@@ -170,7 +170,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 8e6db87f907b217272e64136715ef58237fdc435..6b32507ca63cdfcd8317222d0c4601d10fa90745 100644 (file)
@@ -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)
index ec76860d7df7a706a1a0a2ce71a2cb1c9fef5127..7556bd78ae199eeceea52d76b4ba67bad3fdbeb3 100644 (file)
@@ -362,7 +362,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index 490e9be02a466ab940a00ec631fd83733eea083d..6be16e9ca9b3507876af440fa5f9a4fa5c582d32 100644 (file)
@@ -52,7 +52,7 @@ Petr Pajas
 
 =head1 VERSION
 
-2.0201
+2.0202
 
 =head1 COPYRIGHT
 
index c72183a1bebf16b344dc1a660fee5207cee16e05..259894e8e214ef160947606f4281cbab842469d3 100644 (file)
@@ -188,6 +188,7 @@ if ( @dep_errors ) {
     );
 }
 
+# TEST
 pass;
 
 # vim: ts=4 sts=4 sw=4 et:
index 929654df5de62b79e5f2c550bc6b3679f8914edc..b111507b7978d7e248aac8aec4cb1b5fb8ec8de6 100644 (file)
@@ -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 ); };
index bd6b7471fa15732aeb216e3a9ed62941fa78b0d8..08c2fbbb99290f8ba0e257e55ec9fef90eaa9d8f 100644 (file)
--- 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)
index dafaee0ad6c450c2831a4dcc263b0b4d61e2dd31..e2d985950a7e386226f064e8ea24da04fe6b63cb 100644 (file)
@@ -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');
 
index fb559d586d8063d27e4bc3dd84ebbd8e384bceaa..9a2cff60b0d1eab365431679df036b23ab15f90e 100644 (file)
@@ -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"');
 
index dd579ee6087ce882e4d8aad3dfa3efe696b82ae9..93e618836a1cfbebf9e626f018131bdc2c5f1389 100644 (file)
@@ -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
index 90831ab90afce357a83496a58e0a5ba951391d04..17f641e43a1720643dd0fd92550ecf18376339c6 100644 (file)
@@ -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.' );
+}
index adf03da414833e3f49a41b533034fff815847081..1ccb334b916fdd982939327f08055854c71152cd 100644 (file)
@@ -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;
index 4b75b22e66f9be5feb01f2cb8ee39ad06fc3b849..f08c2ab0e0b89f854643065b09fe1f2c9caf1607 100644 (file)
@@ -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});
index 826f0ad97630678dbb8b96696fbed68d0b13030d..d46fe2306329af69ffdd2f2ea776d48b552640cb 100644 (file)
@@ -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' );
 }
 
 {
index 3422d42f434810da9f2ab4315ba82feafcd705a0..808c0ec76712737cdfaf6a8abd1f46af859c9176 100644 (file)
@@ -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,
     [],
index 45bf5e8af99d71a9d82ac37d7ff2f191d6d09f41..bf396f70016468214e2063824b6a19dc5a8cfae7 100644 (file)
@@ -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');
index d684fa4463cb5edb931f8ee9c44b9aeb7d6ee766..c1c06be75f061ee35bef8641c210c4fbe6dad649 100644 (file)
@@ -27,6 +27,7 @@ use XML::LibXML;
 
     close($fh);
 
+    # TEST
     is($buf, '', 'No warning emitted on load_html with recover => 2.');
 }
 
index 24ee7be2b6c1d8706f59bc6f229d469a43b441ff..98b90321cd2bac206c717fd9efc8924f3b3994e9 100644 (file)
@@ -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, '!=';
index 19ad9e5727010e0fb33edd7102cb41e8119fda6d..fd5a0bb8701155441f7d63e13dec25877cb64ffa 100644 (file)
@@ -23,6 +23,7 @@ my $foo = $doc->documentElement;
 my @children_1 = $foo->childNodes;\r
 my @children_2 = $foo->childNodes;\r
 \r
+# TEST\r
 ok($children_1[0]->can('unique_key'), 'unique_key method available')\r
     or exit -1;\r
 \r
diff --git a/test/relaxng/net.rng b/test/relaxng/net.rng
new file mode 100644 (file)
index 0000000..32f8571
--- /dev/null
@@ -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 (file)
index 0000000..21bb390
--- /dev/null
@@ -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>