Hello

I'm having trouble with something that I can't google easily, because I'm not sure what is happening.

I am using a loop to read an xml file into a variable. But each line is having some, and not all, html entities converted into their symbols. These are inside attributes which means the file is no longer digestible by the the prog I need to import it back into. Not well-formed, maybe.

<NODE id="431" text="&lt;P align=&amp;quot;left&amp;quot;&gt;Non-mortgage&amp;amp;nbsp;debts is yes&lt;/P&gt;" type="DataInput" contextstring="OtherPriorityDebts" groupnext="True" branchValue="Yes" dataDefaultV="Yes" dataVisible="False">

...gets converted to ...

<NODE id="431" text="<P align=&quot;left&quot;>Non-mortgage&amp;nbsp;debts is yes</P>" type="DataInput" contextstring="OtherPriorityDebts" groupnext="True" branchValue="Yes" dataDefaultV="Yes" dataVisible="False">

So, within the text attribute the &lt; and &gt; has converted to < or >. (and if I don't put <code> around that, the lt or gt converts here as well, so this seems to be standard.)

This is presumably to do with encoding, but I don't really know how to explore it and to make it not happen.

Could anyone advise?

Thanks for any help.

MorayJ


In reply to Perl converting some html entities when I don't want it to by MorayJ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.