Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Perl converting some html entities when I don't want it to

by daxim (Chaplain)
on Sep 13, 2012 at 11:01 UTC ( #993450=note: print w/replies, xml ) Need Help??

in reply to Perl converting some html entities when I don't want it to

Your problem is the lack of entity-decoding in line 17 of your program.

This works:

use strictures; use HTML::Entities qw(decode_entities); use XML::LibXML qw(); my $xml = XML::LibXML->load_xml(string => <<'XML'); <root> <NODE id="431" text="&lt;P align=&amp;quot;left&amp;quot;&gt;Non-mortg +age&amp;amp;nbsp;debts is yes&lt;/P&gt;" type="DataInput" contextstri +ng="OtherPriorityDebts" group next="True" branchValue="Yes" dataDe +faultV="Yes" dataVisible="False" /> </root> XML for my $node ($xml->findnodes('//NODE')) { my $text = $node->getAttribute('text'); # <P align=&quot;left&quot;>Non-mortgage&amp;nbsp;debts is yes</P> my $html = decode_entities $text; # <P align="left">Non-mortgage&nbsp;debts is yes</P> }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993450]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2016-10-28 02:56 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (374 votes). Check out past polls.