fix(core): update
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
import * as plugins from './smartxml.plugins';
|
||||
import * as plugins from './smartxml.plugins.js';
|
||||
|
||||
export class SmartXml {
|
||||
constructor() {}
|
||||
|
||||
public parseXmlToObject<T = any>(xmlStringArg: string): T {
|
||||
const jsonObject = plugins.fastXmlParser.parse(xmlStringArg);
|
||||
const parser = new plugins.fastXmlParser.XMLParser();
|
||||
const jsonObject = parser.parse(xmlStringArg);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public createXmlFromObject(jsObject: any): string {
|
||||
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({
|
||||
const jsToXmlParser = new plugins.fastXmlParser.XMLBuilder({
|
||||
ignoreAttributes: false,
|
||||
attributeNamePrefix: "@_",
|
||||
format: true,
|
||||
indentBy: ' ',
|
||||
});
|
||||
const xml = jsToXmlParser.parse(jsObject);
|
||||
const xml = jsToXmlParser.build(jsObject);
|
||||
return '<?xml version="1.0" encoding="UTF-8"?>\n' + xml;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user