ToXml.prototype.openTag = function(key) {
this.completeTag();
this.xml += '<' + key;
this.tagIncomplete = true;
}
ToXml.prototype.addAttr = function(key, val) {
this.xml += ' ' + key + '="' + val + '"';
}
ToXml.prototype.addTextContent = function(text) {
this.completeTag();
this.xml += text;
}
ToXml.prototype.closeTag = function(key) {
this.completeTag();
this.xml += '</' + key + '>';
}
ToXml.prototype.completeTag = function() {
if (this.tagIncomplete) {
this.xml += '>';
this.tagIncomplete = false;
}
}
function ToXml() {
this.xml = '';
this.tagIncomplete = false;
}