Skip to content

Commit

Permalink
Unescape elements using # codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lloyd Watkin committed Nov 26, 2014
1 parent bd2d23f commit bb8980e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/sax/sax_ltx.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ SaxLtx.prototype.end = function(data) {

function unescapeXml(s) {
return s.
replace(/\&/g, '&').
replace(/\&lt;/g, '<').
replace(/\&gt;/g, '>').
replace(/\&quot;/g, '"').
replace(/\&apos;/g, '\'').
replace(/\&#xA;/g, '\n')
replace(/\&(amp|#38);/g, '&').
replace(/\&(lt|#60);/g, '<').
replace(/\&(gt|#62);/g, '>').
replace(/\&(quot|#34);/g, '"').
replace(/\&(apos|#39);/g, '\'').
replace(/\&(nbsp|#160);/g, '\n')
}

1 comment on commit bb8980e

@dimatill
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, guys! Why do you replace &nbsp; to \n? Maybe this is mistake that &(nbsp|#160); was added instead &#xA;? I have a bug in my cloud editor project based on node-xmpp due to replacing &nbsp; to newline :(

Please sign in to comment.