Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed cf7d16c

Log: Modified Files:
LibXML.pm
o version number update

LibXML.xs
+ made libxml2 2.5.7 run properly again

Changes
o version information

Makefile.PL
+ updated blacklist (included libxml2 5.6.8)

example/libxml.dkb
+ Note about forbidden parser instances in callbacks
+ More information about insertBefore() and insertAfter()
+ version information

t/02parse.t
o fixed a typo

Submitted by:
Reviewed by:
PR:

  • Participants
  • Parent commits f37d805

Comments (0)

Files changed (6)

    - minor code cleanups
    - updated libxml2 blacklist.
    - fixed croak while requesting nodeName() of CDATA sections (bug 1694).
+   - more documentation updates
 
 1.57
    - added cloneNode to XML::LibXML::Document
 use IO::Handle; # for FH reads called as methods
 
 
-$VERSION = "1.57";
+$VERSION = "1.58";
 require Exporter;
 require DynaLoader;
 
         item = hv_fetch( real_obj, "XML_LIBXML_PEDANTIC", 19, 0 );
         if ( item != NULL && SvTRUE(*item) ) {
 #ifdef LIBXML_THREAD_ENABLED
+#if LIBXML_VERSION != 20507
             xmlThrDefPedanticParserDefaultValue( 1 );
 #endif
+#endif
             xmlPedanticParserDefaultValue = 1;
         }
         else {
 #ifdef LIBXML_THREAD_ENABLED
+#if LIBXML_VERSION != 20507
             xmlThrDefPedanticParserDefaultValue( 0 );
 #endif
+#endif
             xmlPedanticParserDefaultValue = 0;
         }
 
         SV* ref
     PREINIT:
         xmlNodePtr oNode = NULL, rNode;
-    CODE:
+    INIT:
         oNode = PmmSvNode(ref);
+    CODE:
         if ( self->type    == XML_DOCUMENT_NODE
              && nNode->type == XML_ELEMENT_NODE ) {
             xs_warn( "NOT_SUPPORTED_ERR\n" );
         xmlSaveNoEmptyTags = oldTagFlag;
 
         if ( ret != NULL ) {
-            if ( useDomEncoding!= &PL_sv_undef && SvTRUE(useDomEncoding) ) {
+            if ( useDomEncoding != &PL_sv_undef && SvTRUE(useDomEncoding) ) {
                 RETVAL = nodeC2Sv((xmlChar*)ret, PmmNODE(PmmPROXYNODE(self))) ;
             }
             else {
 unless ( $is_Win32 ) { # cannot get config in W32
     my @blacklist = (
                      [2,4,22,0],
+                     [2,4,25,0], # broken xpaths
                      [2,4,28,1],
                      [2,4,29,0],
                      [2,4,30,0],
                      [2,6,3,0],
                      [2,6,4,0], # schema error
                      [2,6,5,0], # broken xincludes
-                     [2,6,7,1],
+                     [2,6,8,1],
 
                     );
     my $xml2cfg = "xml2-config";

File example/libxml.dkb

         <surname>Glahn</surname>
       </author>
     </authorgroup>
-    <edition>1.57</edition>
+    <edition>1.58</edition>
     <copyright>
       <year>2001-2004</year>
       <holder>AxKit.com Ltd; 2002-2004 Christian Glahn</holder>
             <para>version 2.6.5: tested; not working (broken XIncludes)</para>
           </listitem>
           <listitem>
-            <para>up to version 2.6.7: tested; working</para>
+            <para>up to version 2.6.8: tested; working</para>
           </listitem>
         </itemizedlist>
         <para>It happens, that an older version of libxml2 passes all tests
         that OS prior to version 10.2.2. Since I don&#39;t have full access to
         this OS, help/ patches from OS X gurus are highly apprecheated.</para>
         <para>It is confirmed that XML::LibXML builds and runs without
-        problems with Mac OS X 10.2.6.</para>
+        problems since Mac OS X 10.2.6.</para>
       </sect2>
       <sect2>
         <title>Notes for HPUX</title>
                 <funcsynopsisinfo>$parser-&#62;read_callback($subref);</funcsynopsisinfo>
               </funcsynopsis>
               <para>Read a certain number of bytes from the resource. This
-              callback is called even if the entire Document has already read.</para>
+              callback is called even if the entire Document has already read.
+              This callback has to return a string which will be parsed by the
+              libxml2 parser.</para>
             </listitem>
           </varlistentry>
           <varlistentry>
             </listitem>
           </varlistentry>
         </variablelist>
+        <para>It is important that one must not create a new parser instance
+        and parse some XML data from within any callback. This is forbidden,
+        because the new parser will override the existing callbacks and will
+        leave the calling parser in an undefined state. Most likely memory
+        violations will follow and break the running parsing process without
+        returning control to the perl layer. </para>
         <para>The following example explains the concept a bit. It is a purely
         fictitious example that uses a MyScheme::Handler object that responds
         to methods similar to an IO::Handle.</para>
           </funcsynopsis>
           <para>The method inserts <function>$newNode</function> before
           <function>$refNode</function>. If <function>$refNode</function> is
-          undefined, the newNode will be set as the new first child of the
+          undefined, the newNode will be set as the new last child of the
           parent node. This function differs from the DOM L2 specification, in
           the case, if the new node is not part of the document, the node will
-          be imported first.</para>
+          be imported first, automatically.</para>
+          <para>$refNode has to be passed to the function even if it is
+          undefined:</para>
+          <programlisting> $node-&#62;insertBefore( $newNode, undef ); # the same as $node-&#62;appendChild( $newNode );
+ $node-&#62;insertBefore( $newNode ); # wrong</programlisting>
+          <para>Note, that the reference node has to be a direct child of the
+          node the function is called on. Also, $newChild is not allowed to be
+          an ancestor of the new parent node.</para>
         </listitem>
       </varlistentry>
     </variablelist>
           <function>$refNode</function>. If <function>$refNode</function> is
           undefined, the newNode will be set as the new last child of the
           parent node.</para>
+          <para>Note, that $refNode has to be passed explicitly even if it is
+          undef.</para>
         </listitem>
       </varlistentry>
     </variablelist>
     </variablelist>
     <variablelist>
       <varlistentry>
-        <term>removeChildNode</term>
+        <term>removeChildNodes</term>
         <listitem>
           <funcsynopsis>
             <funcsynopsisinfo>$node-&#62;removeChildNodes();</funcsynopsisinfo>
 
 }
 
-if ( XML::LibXML::LibXML_VERSION >= 20600 )
+print "# " . XML::LibXML::LIBXML_VERSION . "\n";
+if ( XML::LibXML::LIBXML_VERSION >= 20600 )
 {
     print "# 8 Clean Namespaces\n";