fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-25 22:19:44 +00:00
parent 933a5e0a45
commit deda012e03
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,8 @@ tap.test('should create an instance', async () => {
tap.test('should create an xml string', async () => {
const xmlResult = testSmartxml.createXmlFromObject({
hello: {
"@_xlmns:teststring": "hellothere",
"@_xlmns:testnumber": 10,
wow: 'test'
}
});

View File

@ -9,7 +9,10 @@ export class SmartXml {
}
public createXmlFromObject(jsObject: any): string {
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({});
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({
ignoreAttributes: false,
attributeNamePrefix: "@_"
});
const xml = jsToXmlParser.parse(jsObject);
return xml;
}