Skip to content

Commit

Permalink
cdata comming
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Nov 22, 2011
1 parent deefd45 commit 1112daf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/xml-writer.js
Expand Up @@ -14,6 +14,7 @@ function XMLWriter(indent, callback) {
var texts = 0;
var comment = 0;
var pi = 0;
var cdata = 0;
var writer;

if (typeof callback == 'function') {
Expand Down Expand Up @@ -194,15 +195,26 @@ function XMLWriter(indent, callback) {
pi = 0;
return this;
}
}
module.exports = XMLWriter;
/* this.writeCData = function() {
this.writeCData = function(content) {
return this.startCData().text(content).endCData();
}
this.startCData = function() {
if (cdata) return this;
if (attributes) this.endAttributes();
write('<![CDATA[');
cdata = 1;
return this;
}
this.endCData = function() {
if (!cdata) return this;
write(']]>');
cdata = 0;
return this;
}
this.endDTDAttlist = function() {

}
module.exports = XMLWriter;
/* this.endDTDAttlist = function() {
}
this.endDTDElement = function() {
}
Expand Down
Empty file added test/cdata.js
Empty file.

0 comments on commit 1112daf

Please sign in to comment.