16 lines
437 B
TypeScript
16 lines
437 B
TypeScript
import * as plugins from './smartxml.plugins';
|
|
|
|
export class SmartXml {
|
|
constructor() {}
|
|
|
|
public parseXmlToObject<T = any>(xmlStringArg: string): T {
|
|
const jsonObject = plugins.fastXmlParser.parse(xmlStringArg);
|
|
return jsonObject;
|
|
}
|
|
|
|
public createXmlFromObject(jsObject: any): string {
|
|
const jsToXmlParser = new plugins.fastXmlParser.j2xParser({});
|
|
const xml = jsToXmlParser.parse(jsObject);
|
|
return xml;
|
|
}
|
|
} |