I'm trying to parse an XML file I get from an external source but am having problems because there are unencoded XML entities in the text nodes.
Essentially, I'm asking the same question as this, but for Perl instead of PHP.
<report>
<company>A & W</company>
<company>Some Other Company with a < in Inc.</company>
</report>
I tried using something like this:
my $readAllRecordsURI = "http://mycompany.com/CompanyOnline/GetRecord";
my @form_array = ("action" => "readAll", "table" => "QOPIDINF");
my $ua = LWP::UserAgent->new;
my $cics_request = (POST $readAllRecordsURI, \@form_array);
my $cics_response = $ua->request($cics_request);
my $xmlfile = $cics_response->content;
my $parser = XML::Parser->new( Handlers => {Char => \&handle_char});
$parser->parsefile( $xmlfile );
sub handle_char {
my ($p, $string) = @_;
#clean up text here...
}