r44436 - in /trunk/libxml-parser-lite-tree-perl: MANIFEST META.yml README debian/changelog debian/control debian/copyright lib/XML/Parser/Lite/Tree.pm lib/XML/Parser/LiteCopy.pm t/00_xmlparserlite.t t/08_cdata.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Sep 20 19:06:15 UTC 2009
Author: jawnsy-guest
Date: Sun Sep 20 19:06:09 2009
New Revision: 44436
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44436
Log:
* New upstream release
* Updated copyright information
Added:
trunk/libxml-parser-lite-tree-perl/t/00_xmlparserlite.t
- copied unchanged from r44435, branches/upstream/libxml-parser-lite-tree-perl/current/t/00_xmlparserlite.t
trunk/libxml-parser-lite-tree-perl/t/08_cdata.t
- copied unchanged from r44435, branches/upstream/libxml-parser-lite-tree-perl/current/t/08_cdata.t
Modified:
trunk/libxml-parser-lite-tree-perl/MANIFEST
trunk/libxml-parser-lite-tree-perl/META.yml
trunk/libxml-parser-lite-tree-perl/README
trunk/libxml-parser-lite-tree-perl/debian/changelog
trunk/libxml-parser-lite-tree-perl/debian/control
trunk/libxml-parser-lite-tree-perl/debian/copyright
trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/Lite/Tree.pm
trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/LiteCopy.pm
Modified: trunk/libxml-parser-lite-tree-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/MANIFEST?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/MANIFEST (original)
+++ trunk/libxml-parser-lite-tree-perl/MANIFEST Sun Sep 20 19:06:09 2009
@@ -1,6 +1,7 @@
Makefile.PL
MANIFEST
README
+t/00_xmlparserlite.t
t/01_basic.t
t/02_options.t
t/03_comments.t
@@ -8,6 +9,7 @@
t/05_doctypes.t
t/06_attributes.t
t/07_stack.t
+t/08_cdata.t
lib/XML/Parser/LiteCopy.pm
lib/XML/Parser/Lite/Tree.pm
META.yml Module meta-data (added by MakeMaker)
Modified: trunk/libxml-parser-lite-tree-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/META.yml?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/META.yml (original)
+++ trunk/libxml-parser-lite-tree-perl/META.yml Sun Sep 20 19:06:09 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-Parser-Lite-Tree
-version: 0.11
+version: 0.12
version_from: lib/XML/Parser/Lite/Tree.pm
installdirs: site
requires:
Modified: trunk/libxml-parser-lite-tree-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/README?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/README (original)
+++ trunk/libxml-parser-lite-tree-perl/README Sun Sep 20 19:06:09 2009
@@ -29,5 +29,6 @@
Contains XML::Parser::Lite:
Copyright (C) 2000-2007 Paul Kulchenko <paulclinger at yahoo.com>
Copyright (C) 2008 Martin Kutter <martin.kutter at fen-net.de>
+Copyright (C) 2009 Cal Henderson <cal at iamcal.com>
SOAP::Lite is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
Modified: trunk/libxml-parser-lite-tree-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/debian/changelog?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/debian/changelog (original)
+++ trunk/libxml-parser-lite-tree-perl/debian/changelog Sun Sep 20 19:06:09 2009
@@ -1,8 +1,13 @@
-libxml-parser-lite-tree-perl (0.11-2) UNRELEASED; urgency=low
+libxml-parser-lite-tree-perl (0.12-1) UNRELEASED; urgency=low
+ [ Jonathan Yu ]
+ * New upstream release
+ * Updated copyright information
+
+ [ Ryan Niebur ]
* Update jawnsy's email address
- -- Ryan Niebur <ryanryan52 at gmail.com> Tue, 01 Sep 2009 21:20:07 -0700
+ -- Jonathan Yu <jawnsy at cpan.org> Sun, 20 Sep 2009 10:57:24 -0400
libxml-parser-lite-tree-perl (0.11-1) unstable; urgency=low
Modified: trunk/libxml-parser-lite-tree-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/debian/control?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/debian/control (original)
+++ trunk/libxml-parser-lite-tree-perl/debian/control Sun Sep 20 19:06:09 2009
@@ -17,6 +17,6 @@
Depends: ${perl:Depends}, ${misc:Depends}, libsoap-lite-perl (>= 0.70.04-4)
Description: lightweight XML tree builder
XML::Parser::Lite::Tree is a singleton class for parsing XML into a tree
- structure. How does this differ from other XML tree generators? By using
- XML::Parser::Lite, which is a pure perl XML parser. Using this module you can
+ structure. It differs from other XML tree generators because it is based on
+ XML::Parser::Lite, which is a Pure Perl XML parser. Using this module you can
tree-ify simple XML without having to compile any C.
Modified: trunk/libxml-parser-lite-tree-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/debian/copyright?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/debian/copyright (original)
+++ trunk/libxml-parser-lite-tree-perl/debian/copyright Sun Sep 20 19:06:09 2009
@@ -9,16 +9,16 @@
License: Artistic-2.0
Files: lib/XML/Parser/LiteCopy.pm
-Copyright: 2008, Martin Kutter <martin.kutter at fen-net.de>
+Copyright: 2009, Cal Henderson <cal at iamcal.com>
+ 2008, Martin Kutter <martin.kutter at fen-net.de>
2000-2007, Paul Kulchenko <paulclinger at yahoo.com>
License-Alias: Perl
License: Artistic | GPL-1+
Files: debian/*
Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
+ 2007-2008, Jose Luis Rivas <ghostbar38 at gmail.com>
2008, MartÃn Ferrari <martin.ferrari at gmail.com>
- 2007-2008, Jose Luis Rivas <ghostbar38 at gmail.com>
-License-Alias: Perl
License: Artistic | GPL-1+
License: Artistic
@@ -34,6 +34,7 @@
license document, but changing it is not allowed.
.
Preamble
+ .
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
@@ -47,9 +48,10 @@
a different licensing arrangement.
.
Definitions
+ .
"Copyright Holder" means the individual(s) or organization(s) named in
the copyright notice for the entire Package.
-`
+ .
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
@@ -89,10 +91,12 @@
of the Source form.
.
Permission for Use and Modification Without Distribution
+ .
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
- you do not Distribute the Modified Version. Permissions for
- Redistribution of the Standard Version
+ you do not Distribute the Modified Version.
+ .
+ Permissions for Redistribution of the Standard Version
.
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
@@ -104,8 +108,9 @@
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
- will be subject to the Original License. Distribution of Modified
- Versions of the Package as Source
+ will be subject to the Original License.
+ .
+ Distribution of Modified Versions of the Package as Source
.
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
@@ -128,8 +133,10 @@
that the licensee received, and requires that the Source form of the
Modified Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor Fees are
- allowed. Distribution of Compiled Forms of the Standard Version or
- Modified Versions without the Source
+ allowed.
+ .
+ Distribution of Compiled Forms of the Standard Version or Modified
+ Versions without the Source
.
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
@@ -143,7 +150,9 @@
.
(6) You may Distribute a Modified Version in Compiled form without the
Source, provided that you comply with Section 4 with respect to the
- Source of the Modified Version. Aggregating or Linking the Package
+ Source of the Modified Version.
+ .
+ Aggregating or Linking the Package
.
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
@@ -158,13 +167,16 @@
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
+ .
Items That are Not Considered Part of a Modified Version
.
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
- terms of this license. General Provisions
+ terms of this license.
+ .
+ General Provisions
.
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
Modified: trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/Lite/Tree.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/Lite/Tree.pm?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/Lite/Tree.pm (original)
+++ trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/Lite/Tree.pm Sun Sep 20 19:06:09 2009
@@ -5,7 +5,7 @@
use warnings;
use XML::Parser::LiteCopy;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use vars qw( $parser );
@@ -25,9 +25,10 @@
Handlers => {
Start => sub { $self->_start_tag(@_); },
Char => sub { $self->_do_char(@_); },
+ CData => sub { $self->_do_cdata(@_); },
End => sub { $self->_end_tag(@_); },
Comment => sub { $self->_do_comment(@_); },
- XMLDecl => sub { $self->_do_xmldecl(@_); },
+ PI => sub { $self->_do_pi(@_); },
Doctype => sub { $self->_do_doctype(@_); },
};
$self->{process_ns} = $self->{opts}->{process_ns} || 0;
@@ -99,6 +100,22 @@
1;
}
+sub _do_cdata {
+ my $self = shift;
+ shift;
+
+ for my $content(@_){
+
+ my $new_tag = {
+ 'type' => 'cdata',
+ 'content' => $content,
+ };
+
+ push @{$self->{tag_stack}->[-1]->{children}}, $new_tag;
+ }
+ 1;
+}
+
sub _end_tag {
my $self = shift;
@@ -122,7 +139,7 @@
1;
}
-sub _do_xmldecl {
+sub _do_pi {
my $self = shift;
shift;
@@ -271,12 +288,9 @@
if ($obj->{type} eq 'pi'){
- if ($obj->{content} =~ m/^(\S+)\s+(.*)\?$/s){
-
- delete $obj->{content};
- $obj->{target} = $1;
- $obj->{content} = $2;
- }
+ my ($x, $y) = split /\s+/, $obj->{content}, 2;
+ $obj->{target} = $x;
+ $obj->{content} = $y;
}
@@ -286,12 +300,9 @@
if ($obj->{type} eq 'dtd'){
- if ($obj->{content} =~ m/^(\S+)\s+(.*)$/s){
-
- delete $obj->{content};
- $obj->{name} = $1;
- $obj->{content} = $2;
- }
+ my ($x, $y) = split /\s+/, $obj->{content}, 2;
+ $obj->{name} = $x;
+ $obj->{content} = $y;
}
Modified: trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/LiteCopy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/LiteCopy.pm?rev=44436&op=diff
==============================================================================
--- trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/LiteCopy.pm (original)
+++ trunk/libxml-parser-lite-tree-perl/lib/XML/Parser/LiteCopy.pm Sun Sep 20 19:06:09 2009
@@ -1,25 +1,22 @@
-# NOTE: This module comes from SOAP::Lite, which you probably don't
-# have, so it's repackaged here to avoid the huge dependancy tree.
-# also, the current version in CPAN doesn't run under older perls
-# so i've removed the 'use version' magic. And it's been renamed
-# so that search.cpan.org doesn't whine at me
-
-# ======================================================================
+# NOTE: This module originally came from SOAP::Lite, which you probably
+# don't have. It was first repackaged here just to avoid the huge
+# dependancy tree, but this version has several features (CDATA
+# support, better PI and Comment support) that have been added.
+
#
# Copyright (C) 2000-2007 Paul Kulchenko (paulclinger at yahoo.com)
# Copyright (C) 2008 Martin Kutter (martin.kutter at fen-net.de)
+# Copyright (C) 2009 Cal Henderson (cal at iamcal.com)
+#
# SOAP::Lite is free software; you can redistribute it
# and/or modify it under the same terms as Perl itself.
#
-# $Id: Lite.pm 249 2008-05-05 20:35:05Z kutterma $
-#
-# ======================================================================
package XML::Parser::LiteCopy;
use strict;
use vars qw($VERSION);
-$VERSION = '0.710.05';
+$VERSION = '0.720.00';
sub new {
my $class = shift;
@@ -41,7 +38,7 @@
no strict 'refs'; local $^W;
# clear all handlers if called without parameters
if (not @_) {
- for (qw(Start End Char Final Init Comment Doctype XMLDecl)) {
+ for (qw(Start End Char Final Init CData Comment Doctype PI)) {
*$_ = sub {}
}
}
@@ -69,42 +66,47 @@
# this copyright and citation notice remains intact and that modifications
# or additions are clearly identified.
- # Modifications may be tracked on SOAP::Lite's SVN at
- # https://soaplite.svn.sourceforge.net/svnroot/soaplite/
- #
use re 'eval';
my $TextSE = "[^<]+";
- my $UntilHyphen = "[^-]*-";
- my $Until2Hyphens = "([^-]*)-(?:[^-]$[^-]*-)*-";
- my $CommentCE = "$Until2Hyphens(?{${package}::comment(\$2)})>?";
-# my $Until2Hyphens = "$UntilHyphen(?:[^-]$UntilHyphen)*-";
-# my $CommentCE = "$Until2Hyphens>?";
+
+ # the following backrefs have been added:
+ # 1 : TextSE
+ # 2 : MarkupSPE / DeclCE / CommentCE
+ # 3 : MarkupSPE / DeclCE / CDATA_CE
+ # 4 : MarkupSPE / DeclCE / DocTypeCE
+ # 5 : MarkupSPE / PI_CE
+ # 6 : MarkupSPE / EndTagCE
+ # 7+: MarkupSPE / ElemTagCE
+
+ my $Until2Hyphens = "(?:[^-]*)-(?:[^-]+-)*-";
+ my $CommentCE = "($Until2Hyphens)(?{${package}::comment(\$2)})>?";
+
my $UntilRSBs = "[^\\]]*](?:[^\\]]+])*]+";
- my $CDATA_CE = "$UntilRSBs(?:[^\\]>]$UntilRSBs)*>";
+ my $CDATA_CE = "($UntilRSBs(?:[^\\]>]$UntilRSBs)*)(?{${package}::cdata(\$3)})>";
+
my $S = "[ \\n\\t\\r]+";
my $NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]";
my $NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]";
my $Name = "(?:$NameStrt)(?:$NameChar)*";
my $QuoteSE = "\"[^\"]*\"|'[^']*'";
my $DT_IdentSE = "$Name(?:$S(?:$Name|$QuoteSE))*";
-# my $DT_IdentSE = "$S$Name(?:$S(?:$Name|$QuoteSE))*";
my $MarkupDeclCE = "(?:[^\\]\"'><]+|$QuoteSE)*>";
my $S1 = "[\\n\\r\\t ]";
- my $UntilQMs = "[^?]*\\?";
- my $PI_Tail = "\\?>|$S1$UntilQMs(?:[^>?]$UntilQMs)*";
+ my $UntilQMs = "[^?]*\\?+";
+
+ my $PI_Tail = "\\?|$S1$UntilQMs(?:[^>?]$UntilQMs)*";
my $DT_ItemSE = "<(?:!(?:--$Until2Hyphens>|[^-]$MarkupDeclCE)|\\?$Name(?:$PI_Tail>))|%$Name;|$S";
- my $DocTypeCE = "$S($DT_IdentSE(?:$S)?(?:\\[(?:$DT_ItemSE)*](?:$S)?)?)>(?{${package}::_doctype(\$3)})";
-# my $PI_Tail = "\\?>|$S1$UntilQMs(?:[^>?]$UntilQMs)*>";
-# my $DT_ItemSE = "<(?:!(?:--$Until2Hyphens>|[^-]$MarkupDeclCE)|\\?$Name(?:$PI_Tail))|%$Name;|$S";
-# my $DocTypeCE = "$DT_IdentSE(?:$S)?(?:\\[(?:$DT_ItemSE)*](?:$S)?)?>?";
+ my $DocTypeCE = "$S($DT_IdentSE(?:$S)?(?:\\[(?:$DT_ItemSE)*](?:$S)?)?)>(?{${package}::_doctype(\$4)})";
+
my $DeclCE = "--(?:$CommentCE)?|\\[CDATA\\[(?:$CDATA_CE)?|DOCTYPE(?:$DocTypeCE)?";
-# my $PI_CE = "$Name(?:$PI_Tail)?";
- my $PI_CE = "($Name(?:$PI_Tail))>(?{${package}::_xmldecl(\$5)})";
+
+ my $PI_CE = "($Name(?:$PI_Tail))>(?{${package}::_pi(\$5)})";
+
# these expressions were modified for backtracking and events
-# my $EndTagCE = "($Name)(?{${package}::_end(\$2)})(?:$S)?>";
+
my $EndTagCE = "($Name)(?{${package}::_end(\$6)})(?:$S)?>";
my $AttValSE = "\"([^<\"]*)\"|'([^<']*)'";
-# my $ElemTagCE = "($Name)(?:$S($Name)(?:$S)?=(?:$S)?(?:$AttValSE)(?{[\@{\$^R||[]},\$4=>defined\$5?\$5:\$6]}))*(?:$S)?(/)?>(?{${package}::_start( \$3,\@{\$^R||[]})})(?{\${7} and ${package}::_end(\$3)})";
+
my $ElemTagCE = "($Name)"
. "(?:$S($Name)(?:$S)?=(?:$S)?(?:$AttValSE)"
. "(?{[\@{\$^R||[]},\$8=>defined\$9?\$9:\$10]}))*(?:$S)?(/)?>"
@@ -193,23 +195,26 @@
}
sub comment {
- Comment(__PACKAGE__, $_[0]);
+ Comment(__PACKAGE__, substr $_[0], 0, -2);
}
sub end {
pop(@stack) eq $_[0] or die "mismatched tag '$_[0]'\n";
End(__PACKAGE__, $_[0]);
- }
+}
+
+sub cdata {
+ die "CDATA outside of tag stack" unless @stack;
+ CData(__PACKAGE__, substr $_[0], 0, -2);
+}
sub _doctype {
Doctype(__PACKAGE__, $_[0]);
}
-sub _xmldecl {
- XMLDecl(__PACKAGE__, $_[0]);
-}
-
-
+sub _pi {
+ PI(__PACKAGE__, substr $_[0], 0, -1);
+}
# ======================================================================
1;
@@ -218,13 +223,13 @@
=head1 NAME
-XML::Parser::Lite - Lightweight regexp-based XML parser
+XML::Parser::LiteCopy - Lightweight regexp-based XML parser
=head1 SYNOPSIS
- use XML::Parser::Lite;
-
- $p1 = new XML::Parser::Lite;
+ use XML::Parser::LiteCopy;
+
+ $p1 = new XML::Parser::LiteCopy;
$p1->setHandlers(
Start => sub { shift; print "start: @_\n" },
Char => sub { shift; print "char: @_\n" },
@@ -232,7 +237,7 @@
);
$p1->parse('<foo id="me">Hello World!</foo>');
- $p2 = new XML::Parser::Lite
+ $p2 = new XML::Parser::LiteCopy
Handlers => {
Start => sub { shift; print "start: @_\n" },
Char => sub { shift; print "char: @_\n" },
@@ -290,6 +295,10 @@
Char
End
Final
+ CData
+ Doctype
+ Comment
+ PI
All other handlers are ignored.
@@ -325,9 +334,9 @@
See L<XML::Parser> for details
-=head2 XMLDecl
-
-See L<XML::Parser> for details
+=head2 PI
+
+See XMLDecl in L<XML::Parser> for details, but also includes other processing instructions
=head2 Doctype
@@ -346,7 +355,9 @@
Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved.
-Copyright (C) 2008- Martin Kutter. All rights reserved.
+Copyright (C) 2008 Martin Kutter. All rights reserved.
+
+Copyright (C) 2009 Cal Henderson. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
@@ -362,6 +373,8 @@
Additional handlers supplied by Adam Leggett.
+Further modifications by Cal Henderson.
+
=cut
More information about the Pkg-perl-cvs-commits
mailing list