Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &

by psynk (Initiate)
on Mar 08, 2013 at 13:10 UTC ( [id://1022415]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &
in thread Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &

Likely beyond my Perl skill level at the moment, but I'll keep it in mind. Meanwhile, I wrote a small function to fix the data. I also found code strings in the original data that we decided needed fixin', so this function might be all I need at the moment.

sub FixXML { $parm = $_[0]; $parm =~ s/&amp;/&/g; $parm =~ s/&gt;/>/g; $parm =~ s/&lt;/</g; $parm =~ s/&quot;/"/g; $parm =~ s/&apos;/'/g; $parm =~ s/&#xA;/\n/g; $parm =~ s/&#xa;/\n/g; $parm =~ s/&#xD;/\r/g; $parm =~ s/&#xd;/\r/g; $parm =~ s/&#x9;/\t/g; return($parm); }
  • Comment on Re^3: Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &
  • Download Code

Replies are listed 'Best First'.
Re^4: Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &
by Anonymous Monk on Feb 05, 2016 at 20:37 UTC
    Note that this set of regexes will convert '&amp;lt;' to '<' due to the repeated substitutions. But you could do the &amp; substitution last to avoid that. Percents are also documented as something that gets escaped, so you'll want a substitution for that too.
Re^4: Spreadsheet::XLSX returning &lt; &gt; and &amp; instead of < > &
by Anonymous Monk on Feb 08, 2017 at 09:46 UTC
    Thank you, it worked for me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-26 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found