XML Encode String - Node.js String

Node.js examples for String:String Value

Description

XML Encode String

Demo Code



function xmlEncode(text)
{
  return text.replace(/&(?!\w+([;\s]|$))/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}

Related Tutorials