Javascript String decodeXML()

Description

Javascript String decodeXML()


String.prototype.decodeXML = function () {
  var xml_to_chr = {
    '&': '&',
    '"': '"',
    '&lt;': '<',
    '&gt;': '>'
  };//from   w ww  . j  a v a2s .com
  return this.replace(/(&quot;|&lt;|&gt;|&amp;)/g, function(str, item) {
    return xml_to_chr[item];
  });
};



PreviousNext

Related