This commit is contained in:
amitm02
2018-09-04 17:16:31 +03:00
parent 010fde6258
commit 03c4190c2c
20 changed files with 363 additions and 117 deletions

View File

@ -7,6 +7,8 @@ export const parseOptions = {
ignoreAttributes: false,
attributeNamePrefix: "",
attrNodeName: "_attr",
textNodeName: '',
trimValues: false
};
/**
@ -57,6 +59,7 @@ export class ImportedXmlComponent extends XmlComponent {
private _attr: any;
constructor(rootKey: string, _attr?: any) {
super(rootKey);
if (_attr) {
this._attr = _attr;

View File

@ -8,12 +8,6 @@ export abstract class XmlComponent extends BaseXmlComponent {
constructor(rootKey: string, initContent? : XmlComponent) {
super(rootKey);
this.root = initContent ? initContent.root : new Array<BaseXmlComponent>();
if (initContent) {
console.log('\n\n-------\n\n');
console.log('new root', JSON.stringify(initContent, null,2));
console.log('\n\n-------\n\n');
}
}
public prepForXml(): IXmlableObject {
@ -30,7 +24,7 @@ export abstract class XmlComponent extends BaseXmlComponent {
}
return comp;
})
.filter((comp) => comp); // Exclude null, undefined, and empty strings
.filter((comp) => comp !== null); // Exclude null, undefined, and empty strings
return {
[this.rootKey]: children,
};