diff --exclude=.svn -ur XML-TreeBuilder-3.09/Changes perl-XML-TreeBuilder/Changes
--- XML-TreeBuilder-3.09/Changes 2004-06-11 14:28:41.000000000 +1000
+++ perl-XML-TreeBuilder/Changes 2008-01-18 14:28:37.000000000 +1000
@@ -1,5 +1,11 @@
# Time-stamp: "2004-06-10 20:28:41 ADT"
+2007-12-01 Jeff Fearn <jfearn@redhat.com>
+
+ Release 3.10
+
+ Added NoExpand option to allow entities to be left untouched in xml.
+
2004-06-10 Sean M. Burke <sburke@cpan.org>
diff --exclude=.svn -ur XML-TreeBuilder-3.09/lib/XML/TreeBuilder.pm perl-XML-TreeBuilder/lib/XML/TreeBuilder.pm
--- XML-TreeBuilder-3.09/lib/XML/TreeBuilder.pm 2004-06-11 13:59:14.000000000 +1000
+++ perl-XML-TreeBuilder/lib/XML/TreeBuilder.pm 2008-01-18 16:09:10.000000000 +1000
@@ -5,6 +5,7 @@
use strict;
use XML::Element ();
use XML::Parser ();
+use Carp;
use vars qw(@ISA $VERSION);
$VERSION = '3.09';
@@ -12,20 +13,33 @@
#==========================================================================
sub new {
- my $class = ref($_[0]) || $_[0];
- # that's the only parameter it knows
+ my ($this, $arg) = @_;
+ my $class = ref($this) || $this;
+
+ my $NoExpand = defined $arg->{'NoExpand'} ? delete $arg->{'NoExpand'} : 0;
+
+ if ( %{$arg} ) {
+ croak "unknown args: " . join( ", ", keys %{$arg} );
+ }
my $self = XML::Element->new('NIL');
bless $self, $class; # and rebless
- $self->{'_element_class'} = 'XML::Element';
+ $self->{'_element_class'} = 'XML::Element';
$self->{'_store_comments'} = 0;
$self->{'_store_pis'} = 0;
$self->{'_store_declarations'} = 0;
+ $self->{'NoExpand'} = $NoExpand;
my @stack;
# Compare the simplicity of this to the sheer nastiness of HTML::TreeBuilder!
$self->{'_xml_parser'} = XML::Parser->new( 'Handlers' => {
+ 'Default' => sub {
+ if ( ( $self->{'NoExpand'} ) && ( $_[1] =~ /&.*\;/ ) ) {
+ $stack[-1]->push_content( $_[1] );
+ }
+ return;
+ },
'Start' => sub {
shift;
if(@stack) {
@@ -103,7 +117,8 @@
return;
},
- });
+ },
+ 'NoExpand' => $self->{'NoExpand'});
return $self;
}
diff --exclude=.svn -ur XML-TreeBuilder-3.09/t/10main.t perl-XML-TreeBuilder/t/10main.t
--- XML-TreeBuilder-3.09/t/10main.t 2004-06-11 14:22:53.000000000 +1000
+++ perl-XML-TreeBuilder/t/10main.t 2008-01-17 13:24:55.000000000 +1000
@@ -20,7 +20,7 @@
);
my $y = XML::Element->new_from_lol(
- ['Gee',
+ ['Gee', { 'NoExpand' => '0'},
['~comment', {'text' => ' myorp '}],
['foo', {'Id'=> 'me', 'xml:foo' => 'lal'}, 'Hello World'],
['lor'],
@@ -29,8 +29,7 @@
]
);
-
-ok $x->same_as($y);
+ok($x->same_as($y));
unless( $ENV{'HARNESS_ACTIVE'} ) {
$x->dump;