Skip to content

qie.escapeXml

Signature: qie.escapeXml(value)

Returns: String escapedValue - the escaped value

Escape the value to be used in an XML node.

Parameters

Type Name Description Default
String value the value to be escaped

Example

var xmlMessage =  '' +
  '<?xml version="1.0" encoding="UTF-8"?>\n' +
  '<bookstore>\n' +
  '    <book category="fiction">\n' +
  '        <title lang="en">The > Gatsby</title>\n' +
  '        <author>F. Scott Fitzgerald & Hermione Granger</author>\n' +
  '        <year>@1925</year>\n' +
  '        <price>$10.99</price>\n' +
  '    </book>\n' +
  '</bookstore>';
var escapedXml = qie.escapeXml(xmlMessage);
// Note that it'll escape this whole string as if it was going inside an xml field.
// Also note that message.setNode() for xml messages automatically escapes the data for you.