From bf704ce046136cf51bbdf0be1d48d0e6c4a1e81f Mon Sep 17 00:00:00 2001 From: Sven Varkel Date: Fri, 22 May 2015 08:43:37 +0300 Subject: [PATCH] #16 --- lib/xml-writer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/xml-writer.js b/lib/xml-writer.js index 70ac5a4..903e9cd 100644 --- a/lib/xml-writer.js +++ b/lib/xml-writer.js @@ -12,7 +12,7 @@ function strval(s) { } else if (typeof s == 'function') { return s(); - } + } else if (s instanceof XMLWriter) { return s.toString(); } @@ -82,7 +82,7 @@ XMLWriter.prototype = { startDocument : function (version, encoding, standalone) { if (this.tags || this.attributes) return this; - + this.startPI('xml'); this.startAttribute('version'); this.text(typeof version == "string" ? version : "1.0"); @@ -91,7 +91,7 @@ XMLWriter.prototype = { this.startAttribute('encoding'); this.text(encoding); this.endAttribute(); - writer_encoding = encoding; + this.writer_encoding = encoding; } if (standalone) { this.startAttribute('standalone'); @@ -130,7 +130,7 @@ XMLWriter.prototype = { this.texts = 0; if (this.stack.length > 0) this.stack[this.stack.length-1].containsTag = true; - + this.stack.push({ name: name, tags: this.tags @@ -152,7 +152,7 @@ XMLWriter.prototype = { this.texts = 0; if (this.stack.length > 0) this.stack[this.stack.length-1].containsTag = true; - + this.stack.push({ name: prefix + ':' + name, tags: this.tags @@ -265,7 +265,7 @@ XMLWriter.prototype = { return this; } else if (this.attributes && !this.attribute) { this.endAttributes(); - } + } if (this.comment || this.cdata) { this.write(content); } @@ -377,7 +377,7 @@ XMLWriter.prototype = { return this; }, - writeRaw : function(content) { + writeRaw : function(content) { content = strval(content); if (!this.tags && !this.comment && !this.pi && !this.cdata) return this; if (this.attributes && this.attribute) {