clear out clearVariables! In comes toXml

This commit is contained in:
felipe
2017-03-09 20:49:14 +01:00
parent 879b9163a3
commit 11e918114d
13 changed files with 26 additions and 141 deletions

View File

@ -16,15 +16,18 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent {
}
}
public replaceKey(): void {
if (this.root !== undefined) {
public toXml(): object {
const attrs = {};
if (this.root != undefined) {
_.forOwn(this.root, (value, key) => {
const newKey = this.xmlKeys[key];
this.root[newKey] = value;
delete this.root[key];
if (value != undefined) {
const newKey = this.xmlKeys[key];
attrs[newKey] = value;
}
});
this[this.rootKey] = this.root;
delete this.root;
}
const ret = {};
ret[this.rootKey] = attrs;
return ret;
}
}