perlquestion
gam3
Is there a way to keep XML::Parser from converting numeric entities into
UTF8?
<p>
Or is there some other parser that will let me do this?
<code>
use strict;
use XML::Parser;
use vars qw($parser);
sub handle_start {
my $self = shift;
my $x = shift;
print "<" . $x . '>' ;
}
sub handle_end {
my $self = shift;
my $x = shift;
print "</" . $x . '>' ;
}
sub handle_char {
my $self = shift;
my $x = shift;
print $x;
}
$parser = XML::Parser->new(
Handlers => {
Start => \&handle_start,
End => \&handle_end,
Char => \&handle_char
}
);
$parser->parse(<<XML);
<start>–</start>
XML
</code>
I would like this program to output
<code>
<start>–</start>
</code>
not
<code>
<start>–</start>
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-424604">
-- gam3<br/>
<small>A picture is worth a thousand words, but takes 200K.</small>
</div></div>