From 6fa00d7fb605f6e133f85e0ff6b373de52c2ea1a Mon Sep 17 00:00:00 2001 From: Keiran Tai Date: Sat, 25 Feb 2017 10:55:14 +0800 Subject: [PATCH] Sanitize text content to format a valid XML text content. --- lib/json2xml.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/json2xml.js b/lib/json2xml.js index b01a5e8..c25dd76 100644 --- a/lib/json2xml.js +++ b/lib/json2xml.js @@ -82,6 +82,9 @@ ToXml.prototype.addAttr = function(key, val) { } ToXml.prototype.addTextContent = function(text) { this.completeTag(); + if (this.options.sanitize) { + text = sanitizer.sanitize(text) + } this.xml += text; } ToXml.prototype.closeTag = function(key) {