Commits

Shlomi Fish  committed 8513c59

Merge InputCallbackFix from Daniel Fetter.

  • Participants
  • Parent commits 3c63322

Comments (0)

Files changed (3)

         - << when calling normalize on a node, processing of children nodes 
         will stop when an empty element node is encountered. >>
         - Thanks to Daniel Frett for the patch.
+    - Apply the patch from Daniel Fetter's InputCallbackFix branch.
+        - a partial fix to https://rt.cpan.org/Public/Bug/Display.html?id=4263 .
+        - Call two $parser->parse_string() in succession.
 
 1.72            Thu Jun 16 19:26:13 IDT 2011
     - Removed a stray file from the MANIFEST
 sub _cleanup_callbacks {
     my $self = shift;
     $self->{XML_LIBXML_CALLBACK_STACK}->cleanup_callbacks();
+
     my $mcb = $self->match_callback();
-    $self->{XML_LIBXML_CALLBACK_STACK}->unregister_callbacks( [$mcb] );
+    my $ocb = $self->open_callback();
+    my $rcb = $self->read_callback();
+    my $ccb = $self->close_callback();
+
+    if ( defined $mcb and defined $ocb and defined $rcb and defined $ccb ) {
+        $self->{XML_LIBXML_CALLBACK_STACK}->unregister_callbacks( [$mcb, $ocb, $rcb, $ccb] );
+    }
 }
 
 sub __read {

File t/28new_callbacks_multiple.t

 # $Id$
 use Test;
-BEGIN { plan tests => 50 }
+BEGIN { plan tests => 70 }
 END { ok(0) unless $loaded }
 use XML::LibXML;
 use IO::File;
         $parser->expand_xinclude(1);
         $parser->input_callbacks($icb);
         my $doc = $parser->parse_string($string);
+        my $doc2 = $parser->parse_string($string);
 
         ok($doc);
         ok($doc->string_value(), "\ntest\nbar..\nbar..\n");
+        ok($doc2);
+        ok($doc2->string_value(), "\ntest\nbar..\nbar..\n");
         print $doc->serialize();
 
         $icb->unregister_callbacks( [ \&match_hash2, \&open_hash,