import * as plugins from './smartxml.plugins.js'; export class SmartXml { constructor() {} public create = plugins.xmlbuilder2.create; public parseXmlToObject(xmlStringArg: string): T { const parser = new plugins.fastXmlParser.XMLParser({ preserveOrder: true, ignoreAttributes: false, parseTagValue: true, parseAttributeValue: true, // ignoreDeclaration: true }); const jsonObject = parser.parse(xmlStringArg); return jsonObject as T; } public createXmlFromObject(jsObject: any): string { const builder = new plugins.fastXmlParser.XMLBuilder({ ignoreAttributes: false, attributeNamePrefix: '@_', format: true, indentBy: ' ' }); const xml = builder.build(jsObject); return '\n' + xml; } }