|
|
 |
perl-xml
XML::SAX::Writer - $self->{InCDATA}
by Aaron Straup Cope other posts by this author
Oct 4 2002 12:47PM messages near this date
view in the new Beta List Site
RE: Transforming legacy (X)HTML into shiny new XML
|
Re: XML::SAX::Writer - $self->{InCDATA}
So, in an effort to try and make sure I'm not completely daft (see last
message) I opened up XML::SAX::Writer::XML.pm and started printing to
STDERR.
It appears that the IsCDATA property of the XML::SAX::Writer object is
being lost somewhere between the calls to start_cdata() and characters().
Where did it go?
#
126 -> /usr/local/bin/perl (5.6.1) ./cdata-test
0.44
XML::SAX::Writer::XML::start_cdata (XML::SAX::Base::start_cdata) : 1
XML::SAX::Writer::XML::characters (XML::SAX::Base::characters) : 0
<bart> <![CDATA[]]>woot</bart>
# cdata-test
package Foo;
use base qw (XML::SAX::Base);
sub woot {
my $self = shift;
$self-> start_document();
$self-> start_element({Name=>"bart"});
$self-> start_cdata();
$self-> characters({Data=>"woot"});
$self-> end_cdata();
$self-> end_element({Name=>"bart"});
$self-> end_document();
}
package main;
use XML::SAX::Writer;
print $XML::SAX::Writer::VERSION."\n";
my $x = Foo-> new(Handler=>XML::SAX::Writer->new());
$x-> woot();
# package XML::SAX::Writer::XML 0.44
sub characters {
my $self = shift;
my $data = shift;
my $caller = (caller(1))[3];
print STDERR __PACKAGE__."::characters ($caller) : $self-> {InCDATA}\n";
# ...
}
sub start_cdata {
my $self = shift;
$self-> _output_element;
$self-> {InCDATA} = 1;
my $cds = $self-> {Encoder}->convert('<![CDATA[');
$self-> {Consumer}->output($cds);
my $caller = (caller(1))[3];
print STDERR __PACKAGE__."::start_cdata ($caller) : $self-> {InCDATA}\n";
}
# Hello, CDATA?
root @ localhost in /usr/local/lib/perl5/site_perl/5.6.1/XML/SAX
108 -> grep InCDATA ./Writer
./Writer/XML.pm:143: if ($self-> {InCDATA}) {
./Writer/XML.pm:411: $self-> {InCDATA} = 1;
./Writer/XML.pm:423: $self-> {InCDATA} = 0;
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Aaron Straup Cope
Robin Berjon
Aaron Straup Cope
|
|
|
 |
|