fix(core): update

This commit is contained in:
2023-10-20 17:38:44 +02:00
parent 5481831711
commit 77c2433edc
14 changed files with 5918 additions and 11229 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartxml',
version: '1.0.7',
description: 'a package for creating and parsing xml formated files'
}

View File

@ -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;
}
}