Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-07-26 19:49 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (401 votes). Check out past polls.