fix(core): update
This commit is contained in:
parent
e75a939214
commit
fb606e734b
@ -17,7 +17,8 @@ tap.test('should create an xml string', async () => {
|
|||||||
hello: {
|
hello: {
|
||||||
"@_xlmns:teststring": "hellothere",
|
"@_xlmns:teststring": "hellothere",
|
||||||
"@_xlmns:testnumber": 10,
|
"@_xlmns:testnumber": 10,
|
||||||
wow: 'test'
|
wow: 'test',
|
||||||
|
url: [{loc: 3},{loc: 3}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(xmlResult);
|
console.log(xmlResult);
|
||||||
|
@ -11,9 +11,11 @@ export class SmartXml {
|
|||||||
public createXmlFromObject(jsObject: any): string {
|
public createXmlFromObject(jsObject: any): string {
|
||||||
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({
|
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({
|
||||||
ignoreAttributes: false,
|
ignoreAttributes: false,
|
||||||
attributeNamePrefix: "@_"
|
attributeNamePrefix: "@_",
|
||||||
|
format: true,
|
||||||
|
indentBy: ' ',
|
||||||
});
|
});
|
||||||
const xml = jsToXmlParser.parse(jsObject);
|
const xml = jsToXmlParser.parse(jsObject);
|
||||||
return xml;
|
return '<?xml version="1.0" encoding="UTF-8"?>\n' + xml;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user