r31254 - in /branches/upstream/libxml-sax-perl/current: ./ SAX/ SAX/PurePerl/ SAX/PurePerl/Reader/ XML-SAX-Base/ t/ testfiles/

antonio-guest at users.alioth.debian.org antonio-guest at users.alioth.debian.org
Sun Mar 1 00:36:55 UTC 2009


Author: antonio-guest
Date: Sun Mar  1 00:36:52 2009
New Revision: 31254

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31254
Log:
[svn-upgrade] Integrating new upstream version, libxml-sax-perl (0.96+dfsg)

Added:
    branches/upstream/libxml-sax-perl/current/t/40cdata.t
    branches/upstream/libxml-sax-perl/current/t/42entities.t
Removed:
    branches/upstream/libxml-sax-perl/current/testfiles/xmltest.xml
Modified:
    branches/upstream/libxml-sax-perl/current/Changes
    branches/upstream/libxml-sax-perl/current/MANIFEST
    branches/upstream/libxml-sax-perl/current/META.yml
    branches/upstream/libxml-sax-perl/current/SAX.pm
    branches/upstream/libxml-sax-perl/current/SAX/DocumentLocator.pm
    branches/upstream/libxml-sax-perl/current/SAX/Intro.pod
    branches/upstream/libxml-sax-perl/current/SAX/ParserFactory.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DTDDecls.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DebugHandler.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DocType.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/EncodingDetect.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Exception.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/NoUnicodeExt.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Productions.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/NoUnicodeExt.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/Stream.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/String.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/URI.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/UnicodeExt.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/UnicodeExt.pm
    branches/upstream/libxml-sax-perl/current/SAX/PurePerl/XMLDecl.pm
    branches/upstream/libxml-sax-perl/current/XML-SAX-Base/Makefile.PL
    branches/upstream/libxml-sax-perl/current/t/00basic.t
    branches/upstream/libxml-sax-perl/current/t/14encoding.t

Modified: branches/upstream/libxml-sax-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/Changes?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/Changes (original)
+++ branches/upstream/libxml-sax-perl/current/Changes Sun Mar  1 00:36:52 2009
@@ -1,67 +1,94 @@
 Revision history for Perl extension XML::SAX.
 
-0.14
-	- Fixed CDATA section parsing (Uwe Voelker)
-	- Fix Makefile.PL for VMS
-	- Support calling set_handler() mid-parse
-	- Fix for when random modules overload UNIVERSAL::AUTOLOAD()
-	- Fix case when ParserDetails.ini isn't being updated but we are doing an
-	  upgrade.
+0.96  06 Aug 2008  Grant McLean
+    - Fix breakage of Unicode regexes on 5.6 (introduced in 0.95 release)
 
-0.13
+0.95  05 Aug 2008  Grant McLean
+    - XML::SAX::PurePerl fixes:
+      - RT#37147: Fix handling of numeric character entities in attribute 
+                  values (report from Jools Smyth)
+      - RT#19442: Fix for numeric character entities spanning end of buffer
+                  (report from Eivind Eklund)
+      - RT#29316: Performance fix for parsing from large strings (patch from
+                  Gordon Lack)
+      - RT#26588: Fix for UTF8 bytes in first 4096 bytes of document not being
+                  decoded to Perl-UTF8-characters (patch from Niko Tyni of the
+                  Debian project)
+      - RT#37545: incorrect operator precedence breaks single quotes around
+                  DTD entity declarations (report from Kevin Ryde)
+    - RT#28477: Fix test in ParserFactory.pm for parser module loaded (report
+                from Douglas Wilson)
+    - RT#28564: Fix XML::SAX::PurePerl versioning (report from Chapman Flack)
+
+0.16  27 Jun 2007  Grant McLean
+    - Applied patch for PI handling from RT#19173
+
+0.15  08 Feb 2007  Grant McLean
+    - Fixed handling of entities in attribute values
+    - Cleaned up some benign warnings
+
+0.14  23 Apr 2006  Matt Sergeant
+    - Fixed CDATA section parsing (Uwe Voelker)
+    - Fix Makefile.PL for VMS
+    - Support calling set_handler() mid-parse
+    - Fix for when random modules overload UNIVERSAL::AUTOLOAD()
+    - Fix case when ParserDetails.ini isn't being updated but we are doing an
+      upgrade.
+
+0.13  24 Oct 2005  Matt Sergeant
     - Complete re-write of XML::SAX::PurePerl for performance
     - Support Encoding & XMLVersion in DocumentLocator interface
     - A few conformance tweaks to match perl SAX 2.1.
 
-0.12
+0.12  20 Nov 2002  Matt Sergeant
     - Made sure SAX.ini works as documented
     - Fixed when you specify Module (version)
-    
-0.11
+
+0.11  03 Sep 2002  Matt Sergeant
     - Base: Merged in XML::SAX::Base 1.04 (including memory leak fixes)
     - ParserFactory: Made it do what the docs say when you specify
       a module version number.
     - SAX: Fixed XML::SAX::Intro typo.
     - ParserFactory: Fixed (and test) broken version in parser pkg
 
-0.10
+0.10  14 Feb 2002  Matt Sergeant
     - PurePerl: Fixed PubidChar missing '-'
     - ParserFactory: Allow version in parser package
 
-0.09
+0.09  06 Feb 2002  Matt Sergeant
     - PurePerl: Performance enhancements
     - PurePerl: Line End handling implemented.
     - PurePerl: Attribute Value Normalization implemented (mostly).
     - PurePerl: Fixed element copying for end_element.
 
-0.08  Wed Jan 30, 2002
+0.08  30 Jan 2002  Matt Sergeant
     - Fixes for perl 5.7.2
-    
-0.07  Tue Jan 29, 2002
+
+0.07  29 Jan 2002  Matt Sergeant
     - Fixed higher utf8 chars to work on both 5.005 and 5.6.1
       (not tested on 5.6.0 since it's a bad perl)
 
-0.06  Mon Jan 28, 2002
+0.06  28 Jan 2002  Matt Sergeant
     - Fixed empty ParserDetails.ini bug
     - Fixed overwriting ParserDetails.ini bug
     - Added ability to specify dir to ParserDetails.ini
 
-0.05  Mon Jan 21, 2002
+0.05  21 Jan 2002  Matt Sergeant
     - Updated PREREQ_PM in Makefile.PL
     - Updated Docs
 
-0.04  Mon Jan 21, 2002
+0.04  21 Jan 2002  Matt Sergeant
     - More PurePerl updates and fixes
     - Added DocumentLocator class
     - Added remove_parser() to XML::SAX
 
-0.03
+0.03  25 Nov 2001 Matt Sergeant
     - Changes lost. Mostly PurePerl parser updates
 
-0.02  Wed Nov 14 2001
+0.02  14 Nov 2001  Matt Sergeant
     - Removed windows line endings so perldocs look ok.
     - Fixed some docs
 
-0.01  Mon Nov  5 22:24:06 2001
+0.01  Mon Nov  5 22:24:06 2001  Matt Sergeant
     - original version; created by elves and penguins v1.32
 

Modified: branches/upstream/libxml-sax-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/MANIFEST?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/MANIFEST (original)
+++ branches/upstream/libxml-sax-perl/current/MANIFEST Sun Mar  1 00:36:52 2009
@@ -76,5 +76,8 @@
 t/16large.t
 t/20factory.t
 t/21saxini.t
+t/40cdata.t
+t/42entities.t
 t/99cleanup.t
+
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: branches/upstream/libxml-sax-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/META.yml?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/META.yml (original)
+++ branches/upstream/libxml-sax-perl/current/META.yml Sun Mar  1 00:36:52 2009
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         XML-SAX
-version:      0.14
+version:      0.96
 version_from: SAX.pm
 installdirs:  site
 requires:
@@ -9,4 +9,4 @@
     XML::NamespaceSupport:         0.03
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+generated_by: ExtUtils::MakeMaker version 6.30_01

Modified: branches/upstream/libxml-sax-perl/current/SAX.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX.pm Sun Mar  1 00:36:52 2009
@@ -1,11 +1,11 @@
-# $Id: SAX.pm,v 1.26 2006/04/23 23:48:31 matt Exp $
+# $Id: SAX.pm,v 1.31 2008-08-05 12:36:24 grant Exp $
 
 package XML::SAX;
 
 use strict;
 use vars qw($VERSION @ISA @EXPORT_OK);
 
-$VERSION = '0.14';
+$VERSION = '0.96';
 
 use Exporter ();
 @ISA = ('Exporter');
@@ -351,6 +351,10 @@
 
 =head1 AUTHOR
 
+Current maintainer: Grant McLean, grantm at cpan.org
+
+Originally written by:
+
 Matt Sergeant, matt at sergeant.org
 
 Kip Hampton, khampton at totalcinema.com

Modified: branches/upstream/libxml-sax-perl/current/SAX/DocumentLocator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/DocumentLocator.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/DocumentLocator.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/DocumentLocator.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: DocumentLocator.pm,v 1.3 2005/10/14 20:31:20 matt Exp $
+# $Id: DocumentLocator.pm,v 1.3 2005-10-14 20:31:20 matt Exp $
 
 package XML::SAX::DocumentLocator;
 use strict;

Modified: branches/upstream/libxml-sax-perl/current/SAX/Intro.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/Intro.pod?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/Intro.pod (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/Intro.pod Sun Mar  1 00:36:52 2009
@@ -348,7 +348,7 @@
 his article on XML.com here <URI>.
 
 To construct SAX pipelines, Barrie Slaymaker, a long time Perl hacker
-who's modules you will probably have heard of or used, wrote a very
+whose modules you will probably have heard of or used, wrote a very
 clever module called XML::SAX::Machines. This combines some really
 clever SAX filter-type modules, with a construction toolkit for filters
 that makes building pipelines easy. But before we see how it makes
@@ -402,6 +402,6 @@
 
 Matt Sergeant, matt at sergeant.org
 
-$Id: Intro.pod,v 1.3 2002/04/30 07:16:00 matt Exp $
+$Id: Intro.pod,v 1.4 2008-08-04 10:28:01 grant Exp $
 
 =cut

Modified: branches/upstream/libxml-sax-perl/current/SAX/ParserFactory.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/ParserFactory.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/ParserFactory.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/ParserFactory.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: ParserFactory.pm,v 1.13 2002/11/19 18:25:47 matt Exp $
+# $Id: ParserFactory.pm,v 1.14 2008-08-04 04:51:29 grant Exp $
 
 package XML::SAX::ParserFactory;
 
@@ -33,11 +33,9 @@
         $version = " $1";
     }
 
-    {
-        no strict 'refs';
-        if (!keys %{"${parser_class}::"}) {
-            eval "use $parser_class $version;";
-        }
+    if (!$parser_class->can('new')) {
+        eval "require $parser_class $version;";
+        die $@ if $@;
     }
 
     return $parser_class->new(@parser_params);

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl.pm Sun Mar  1 00:36:52 2009
@@ -1,13 +1,13 @@
-# $Id: PurePerl.pm,v 1.20 2006/04/23 23:20:09 matt Exp $
+# $Id: PurePerl.pm,v 1.28 2008-08-05 12:36:51 grant Exp $
 
 package XML::SAX::PurePerl;
 
 use strict;
 use vars qw/$VERSION/;
 
-$VERSION = '0.90';
-
-use XML::SAX::PurePerl::Productions qw($Any $CharMinusDash $SingleChar);
+$VERSION = '0.96';
+
+use XML::SAX::PurePerl::Productions qw($NameChar $SingleChar);
 use XML::SAX::PurePerl::Reader;
 use XML::SAX::PurePerl::EncodingDetect ();
 use XML::SAX::Exception;
@@ -374,6 +374,11 @@
     return 0 unless $reader->match('&');
     
     my $data = $reader->data;
+
+    # Fetch more data if we have an incomplete numeric reference
+    if ($data =~ /^(#\d*|#x[0-9a-fA-F]*)$/) {
+        $data = $reader->data(length($data) + 6);
+    }
     
     if ($data =~ /^#x([0-9a-fA-F]+);/) {
         my $ref = $1;
@@ -566,7 +571,8 @@
             unless length($data);
         if ($data =~ /^([^$quote]*)$quote/) {
             $reader->move_along(length($1) + 1);
-            return $value . $1;
+            $value .= $1;
+            last;
         }
         else {
             $value .= $data;
@@ -579,7 +585,7 @@
     }
     
     $value =~ s/[\x09\x0A\x0D]/\x20/g;
-    $value =~ s/&(#(x[0-9a-fA-F]+)|([0-9]+)|\w+);/$self->AttReference($1, $reader)/geo;
+    $value =~ s/&(#(x[0-9a-fA-F]+)|#([0-9]+)|\w+);/$self->AttReference($1, $reader)/geo;
     
     return $value;
 }
@@ -621,22 +627,23 @@
     
     if ($data =~ /^<\?/) {
         $reader->move_along(2);
-        my ($target, $data);
+        my ($target);
         $target = $self->Name($reader) ||
             $self->parser_error("PI has no target", $reader);
+	    
+        my $pi_data = '';
         if ($self->skip_whitespace($reader)) {
-            $target = '';
             while (1) {
                 my $data = $reader->data;
                 $self->parser_error("End of data seen while looking for close PI marker", $reader)
                     unless length($data);
                 if ($data =~ /^(.*?)\?>/s) {
-                    $target .= $1;
+                    $pi_data .= $1;
                     $reader->move_along(length($1) + 2);
                     last;
                 }
                 else {
-                    $target .= $data;
+                    $pi_data .= $data;
                     $reader->move_along(length($data));
                 }
             }
@@ -646,7 +653,8 @@
             $data =~ /^\?>/ or $self->parser_error("PI closing sequence not found", $reader);
             $reader->move_along(2);
         }
-        $self->processing_instruction({ Target => $target, Data => $data });
+	
+        $self->processing_instruction({ Target => $target, Data => $pi_data });
         
         return 1;
     }
@@ -660,7 +668,7 @@
     while(1) {
         my $data = $reader->data;
         return unless length($data);
-        $data =~ /^([^\s>\/&\?;=<\)\(\[\],\%\#\!\*]*)/ or return;
+        $data =~ /^([^\s>\/&\?;=<\)\(\[\],\%\#\!\*\|]*)/ or return;
         $name .= $1;
         my $len = length($1);
         $reader->move_along($len);

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DTDDecls.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DTDDecls.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DTDDecls.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DTDDecls.pm Sun Mar  1 00:36:52 2009
@@ -1,9 +1,9 @@
-# $Id: DTDDecls.pm,v 1.7 2005/10/14 20:31:20 matt Exp $
+# $Id: DTDDecls.pm,v 1.9 2008-08-05 12:37:13 grant Exp $
 
 package XML::SAX::PurePerl;
 
 use strict;
-use XML::SAX::PurePerl::Productions qw($NameChar $SingleChar);
+use XML::SAX::PurePerl::Productions qw($SingleChar);
 
 sub elementdecl {
     my ($self, $reader) = @_;
@@ -469,7 +469,7 @@
     my $data = $reader->data;
     my $quote = '"';
     my $re = $quotre;
-    if (!$data =~ /^"/) {
+    if ($data !~ /^"/) {
         $data =~ /^'/ or $self->parser_error("Not a quote character", $reader);
         $quote = "'";
         $re = $aposre;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DebugHandler.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DebugHandler.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DebugHandler.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DebugHandler.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: DebugHandler.pm,v 1.3 2001/11/24 17:47:53 matt Exp $
+# $Id: DebugHandler.pm,v 1.3 2001-11-24 17:47:53 matt Exp $
 
 package XML::SAX::PurePerl::DebugHandler;
 

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DocType.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DocType.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DocType.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/DocType.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: DocType.pm,v 1.3 2003/07/30 13:39:22 matt Exp $
+# $Id: DocType.pm,v 1.3 2003-07-30 13:39:22 matt Exp $
 
 package XML::SAX::PurePerl;
 

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/EncodingDetect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/EncodingDetect.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/EncodingDetect.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/EncodingDetect.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: EncodingDetect.pm,v 1.5 2003/09/29 20:20:41 matt Exp $
+# $Id: EncodingDetect.pm,v 1.6 2007-02-07 09:33:50 grant Exp $
 
 package XML::SAX::PurePerl; # NB, not ::EncodingDetect!
 
@@ -88,6 +88,10 @@
         # $reader->set_encoding('UTF-8');
         return;
     }
+    elsif ($data =~ /^[\x20\x09\x0A\x0D]+\x3C[^\x3F]/) {
+        # $reader->set_encoding('UTF-8');
+        return;
+    }
     elsif ($data =~ /^\x4C\x6F\xA7\x94/) {
         $reader->set_encoding('EBCDIC');
         return;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Exception.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Exception.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Exception.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Exception.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: Exception.pm,v 1.2 2001/11/14 11:07:25 matt Exp $
+# $Id: Exception.pm,v 1.2 2001-11-14 11:07:25 matt Exp $
 
 package XML::SAX::PurePerl::Exception;
 

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/NoUnicodeExt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/NoUnicodeExt.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/NoUnicodeExt.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/NoUnicodeExt.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: NoUnicodeExt.pm,v 1.1 2002/01/30 17:35:21 matt Exp $
+# $Id: NoUnicodeExt.pm,v 1.1 2002-01-30 17:35:21 matt Exp $
 
 package XML::SAX::PurePerl;
 use strict;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Productions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Productions.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Productions.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Productions.pm Sun Mar  1 00:36:52 2009
@@ -1,10 +1,10 @@
-# $Id: Productions.pm,v 1.11 2003/07/30 13:39:22 matt Exp $
+# $Id: Productions.pm,v 1.13 2008-08-05 12:37:13 grant Exp $
 
 package XML::SAX::PurePerl::Productions;
 
 use Exporter;
 @ISA = ('Exporter');
- at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Letter $Ideographic
+ at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Ideographic
     $Extender $Digit $CombiningChar $EncNameStart $EncNameEnd $NameChar $CharMinusDash
     $PubidChar $Any $SingleChar);
 
@@ -36,12 +36,10 @@
     
     $Digit = qr/ [\x30-\x39] /x;
     
-    $Letter = qr/^ $BaseChar $/x;
-    
     # can't do this one without unicode
     # $CombiningChar = qr/^$/msx;
     
-    $NameChar = qr/^ $BaseChar | $Digit | [._:-] | $Extender $/x;
+    $NameChar = qr/^ (?: $BaseChar | $Digit | [._:-] | $Extender )+ $/x;
     PERL
     die $@ if $@;
 }
@@ -138,9 +136,7 @@
 [\x{4E00}-\x{9FA5}\x{3007}\x{3021}-\x{3029}]
 /x;
 
-    $Letter = qr/^ $BaseChar | $Ideographic $/x;
-
-    $NameChar = qr/^ $Letter | $Digit | [._:-] | $CombiningChar | $Extender $/x;
+    $NameChar = qr/^ (?: $BaseChar | $Ideographic | $Digit | [._:-] | $CombiningChar | $Extender )+ $/x;
     PERL
 
     die $@ if $@;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader.pm Sun Mar  1 00:36:52 2009
@@ -1,10 +1,9 @@
-# $Id: Reader.pm,v 1.11 2005/10/14 20:31:20 matt Exp $
+# $Id: Reader.pm,v 1.13 2008-08-05 12:37:13 grant Exp $
 
 package XML::SAX::PurePerl::Reader;
 
 use strict;
 use XML::SAX::PurePerl::Reader::URI;
-use XML::SAX::PurePerl::Productions qw( $SingleChar $Letter $NameChar );
 use Exporter ();
 
 use vars qw(@ISA @EXPORT_OK);

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/NoUnicodeExt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/NoUnicodeExt.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/NoUnicodeExt.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/NoUnicodeExt.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: NoUnicodeExt.pm,v 1.3 2003/07/30 13:39:23 matt Exp $
+# $Id: NoUnicodeExt.pm,v 1.3 2003-07-30 13:39:23 matt Exp $
 
 package XML::SAX::PurePerl::Reader;
 use strict;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/Stream.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/Stream.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/Stream.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/Stream.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: Stream.pm,v 1.7 2005/10/14 20:31:20 matt Exp $
+# $Id: Stream.pm,v 1.7 2005-10-14 20:31:20 matt Exp $
 
 package XML::SAX::PurePerl::Reader::Stream;
 

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/String.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/String.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/String.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/String.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: String.pm,v 1.5 2003/07/30 13:39:23 matt Exp $
+# $Id: String.pm,v 1.6 2008-08-04 03:35:44 grant Exp $
 
 package XML::SAX::PurePerl::Reader::String;
 
@@ -15,23 +15,40 @@
 
 @ISA = ('XML::SAX::PurePerl::Reader');
 
-use constant DISCARDED => 7;
+use constant DISCARDED  => 8;
+use constant STRING     => 9;
+use constant USED       => 10;
+use constant CHUNK_SIZE => 2048;
 
 sub new {
     my $class = shift;
     my $string = shift;
     my @parts;
-    @parts[BUFFER, EOF, LINE, COLUMN, DISCARDED] =
-        ($string,   0,   1,    0,       '');
+    @parts[BUFFER, EOF, LINE, COLUMN, DISCARDED, STRING, USED] =
+        ('',   0,   1,    0,       0, $string, 0);
     return bless \@parts, $class;
 }
 
-sub read_more () { }
+sub read_more () {
+    my $self = shift;
+    if ($self->[USED] >= length($self->[STRING])) {
+        $self->[EOF]++;
+        return 0;
+    }
+    my $bytes = CHUNK_SIZE;
+    if ($bytes > (length($self->[STRING]) - $self->[USED])) {
+       $bytes = (length($self->[STRING]) - $self->[USED]);
+    }
+    $self->[BUFFER] .= substr($self->[STRING], $self->[USED], $bytes);
+    $self->[USED] += $bytes;
+    return 1;
+ }
+
 
 sub move_along {
-    my $self = shift;
-    my $discarded = substr($self->[BUFFER], 0, $_[0], '');
-    $self->[DISCARDED] .= $discarded;
+    my($self, $bytes) = @_;
+    my $discarded = substr($self->[BUFFER], 0, $bytes, '');
+    $self->[DISCARDED] += length($discarded);
     
     # Wish I could skip this lot - tells us where we are in the file
     my $lines = $discarded =~ tr/\n//;
@@ -55,7 +72,7 @@
 
 sub bytepos {
     my $self = shift;
-    length($self->[DISCARDED]);
+    $self->[DISCARDED];
 }
 
 1;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/URI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/URI.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/URI.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/URI.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: URI.pm,v 1.1 2001/11/11 18:41:51 matt Exp $
+# $Id: URI.pm,v 1.1 2001-11-11 18:41:51 matt Exp $
 
 package XML::SAX::PurePerl::Reader::URI;
 
@@ -48,7 +48,7 @@
             return XML::SAX::PurePerl::Reader::Stream->new($fh);
         }
         else {
-            die "LWP Request Failed : " . $res->status_line;
+            die "LWP Request Failed";
         }
     }
 }

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/UnicodeExt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/UnicodeExt.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/UnicodeExt.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/Reader/UnicodeExt.pm Sun Mar  1 00:36:52 2009
@@ -1,9 +1,9 @@
-# $Id: UnicodeExt.pm,v 1.4 2003/07/30 13:39:23 matt Exp $
+# $Id: UnicodeExt.pm,v 1.5 2008-08-04 10:04:54 grant Exp $
 
 package XML::SAX::PurePerl::Reader;
 use strict;
 
-use Encode;
+use Encode ();
 
 sub set_raw_stream {
     my ($fh) = @_;
@@ -16,7 +16,7 @@
 }
 
 sub switch_encoding_string {
-    Encode::from_to($_[0], $_[1], "utf-8");
+    $_[0] = Encode::decode($_[1], $_[0]);
 }
 
 1;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/UnicodeExt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/UnicodeExt.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/UnicodeExt.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/UnicodeExt.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: UnicodeExt.pm,v 1.1 2002/01/30 17:35:21 matt Exp $
+# $Id: UnicodeExt.pm,v 1.1 2002-01-30 17:35:21 matt Exp $
 
 package XML::SAX::PurePerl;
 use strict;

Modified: branches/upstream/libxml-sax-perl/current/SAX/PurePerl/XMLDecl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/SAX/PurePerl/XMLDecl.pm?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/SAX/PurePerl/XMLDecl.pm (original)
+++ branches/upstream/libxml-sax-perl/current/SAX/PurePerl/XMLDecl.pm Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: XMLDecl.pm,v 1.3 2003/07/30 13:39:22 matt Exp $
+# $Id: XMLDecl.pm,v 1.3 2003-07-30 13:39:22 matt Exp $
 
 package XML::SAX::PurePerl;
 

Modified: branches/upstream/libxml-sax-perl/current/XML-SAX-Base/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/XML-SAX-Base/Makefile.PL?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/XML-SAX-Base/Makefile.PL (original)
+++ branches/upstream/libxml-sax-perl/current/XML-SAX-Base/Makefile.PL Sun Mar  1 00:36:52 2009
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL,v 1.14 2006/04/24 00:13:17 matt Exp $
+# $Id: Makefile.PL,v 1.15 2007-02-07 09:33:50 grant Exp $
 
 use strict;
 
@@ -119,7 +119,7 @@
             $aload_string .= <<"            EOALOADBLOCK";
         elsif (defined \$callbacks->{'$h'} 
         	and \$callbacks->{'$h'}->can('AUTOLOAD')
-        	# and \$callbacks->{'$h'}->can('AUTOLOAD') ne UNIVERSAL->can('AUTOLOAD')
+        	and \$callbacks->{'$h'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
         	)
         {
             my \$res = eval { \$callbacks->{'$h'}->$ev(\@_) };

Modified: branches/upstream/libxml-sax-perl/current/t/00basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/t/00basic.t?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/t/00basic.t (original)
+++ branches/upstream/libxml-sax-perl/current/t/00basic.t Sun Mar  1 00:36:52 2009
@@ -1,6 +1,11 @@
 use Test;
-BEGIN { plan tests => 1 }
-END { ok($loaded) }
+BEGIN { plan tests => 2 }
+END { ok($loaded == 2) }
 use XML::SAX;
 $loaded++;
 
+use XML::SAX::PurePerl;
+$loaded++;
+
+ok(XML::SAX->VERSION eq XML::SAX::PurePerl->VERSION);
+

Modified: branches/upstream/libxml-sax-perl/current/t/14encoding.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/t/14encoding.t?rev=31254&op=diff
==============================================================================
--- branches/upstream/libxml-sax-perl/current/t/14encoding.t (original)
+++ branches/upstream/libxml-sax-perl/current/t/14encoding.t Sun Mar  1 00:36:52 2009
@@ -1,23 +1,25 @@
 use Test;
 BEGIN { $tests = 0;
-    if ($] >= 5.007002) { $tests = 7 }
+    if ($] >= 5.007002) { $tests = 9 }
     plan tests => $tests;
 }
 if ($tests) {
 use XML::SAX::PurePerl;
-use XML::SAX::PurePerl::DebugHandler;
 
-my $handler = XML::SAX::PurePerl::DebugHandler->new();
+my $handler = TestHandler->new(); # see below for the TestHandler class
 ok($handler);
 
 my $parser = XML::SAX::PurePerl->new(Handler => $handler);
 ok($parser);
 
 # warn("utf-16\n");
+# verify that the first element is correctly decoded
+$handler->{test_elements} = [ "\x{9031}\x{5831}" ];
 $parser->parse_uri("testfiles/utf-16.xml");
 ok(1);
 
 # warn("utf-16le\n");
+$handler->{test_elements} = [ "foo" ];
 $parser->parse_uri("testfiles/utf-16le.xml");
 ok(1);
 
@@ -33,3 +35,19 @@
 $parser->parse_uri("testfiles/iso8859_2.xml");
 ok(1);
 }
+
+package TestHandler;
+use XML::SAX::PurePerl::DebugHandler;
+use base qw(XML::SAX::PurePerl::DebugHandler);
+use Test;
+
+sub start_element {
+    my $self = shift;
+    if ($self->{test_elements} and
+        my $value = pop @{$self->{test_elements}}) {
+        ok($_[0]->{Name}, $value);
+    }
+    $self->SUPER::start_element(@_);
+}
+
+1;

Added: branches/upstream/libxml-sax-perl/current/t/40cdata.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/t/40cdata.t?rev=31254&op=file
==============================================================================
--- branches/upstream/libxml-sax-perl/current/t/40cdata.t (added)
+++ branches/upstream/libxml-sax-perl/current/t/40cdata.t Sun Mar  1 00:36:52 2009
@@ -1,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test;
+BEGIN { plan tests => 4 }
+
+use XML::SAX::PurePerl;
+
+my $handler = CDataHandler->new();
+ok($handler);
+
+my $parser = XML::SAX::PurePerl->new(Handler => $handler);
+ok($parser);
+
+$parser->parse_string('<code><![CDATA[<crackers & cheese>]]></code>');
+ok(1); # parser didn't die
+
+my $expected = '<crackers & cheese>';
+ok($handler->cbuffer, $expected);
+
+exit;
+
+
+package CDataHandler;
+
+use base 'XML::SAX::Base';
+
+sub start_document { shift->{_buf} = '';             }
+sub characters     { shift->{_buf} .= shift->{Data}; }
+sub cbuffer        { shift->{_buf};                  }
+

Added: branches/upstream/libxml-sax-perl/current/t/42entities.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-sax-perl/current/t/42entities.t?rev=31254&op=file
==============================================================================
--- branches/upstream/libxml-sax-perl/current/t/42entities.t (added)
+++ branches/upstream/libxml-sax-perl/current/t/42entities.t Sun Mar  1 00:36:52 2009
@@ -1,0 +1,37 @@
+use strict;
+use warnings;
+
+use Test;
+BEGIN { plan tests => 4 }
+
+use XML::SAX::PurePerl;
+
+my $handler = AttrHandler->new();
+ok($handler);
+
+my $parser = XML::SAX::PurePerl->new(Handler => $handler);
+ok($parser);
+
+$parser->parse_string('<code amp="&amp;" x3E="&#x3E;" num="&#65;" />');
+ok(1); # parser didn't die
+
+my $expected = "amp=& num=A x3E=> ";
+ok($handler->attributes, $expected);
+
+exit;
+
+
+package AttrHandler;
+
+use base 'XML::SAX::Base';
+
+sub start_document { shift->{_buf} = '';             }
+sub attributes     { shift->{_buf};                  }
+
+sub start_element {
+    my($self, $data) = @_;
+    my $attr = $data->{Attributes};
+    foreach (sort keys %$attr) {
+        $self->{_buf} .= "$attr->{$_}->{LocalName}=$attr->{$_}->{Value} ";
+    }
+}




More information about the Pkg-perl-cvs-commits mailing list