BREAKING CHANGE(core): Implement custom XmlBuilder, remove xmlbuilder2, upgrade fast-xml-parser, update SmartXml API, tests and CI

This commit is contained in:
2025-11-19 20:40:57 +00:00
parent 292e558d51
commit e7f6805eab
14 changed files with 4286 additions and 3012 deletions

View File

@@ -1,9 +1,10 @@
import * as plugins from './smartxml.plugins.js';
import { XmlBuilder } from './smartxml.xmlbuilder.js';
export class SmartXml {
constructor() {}
public create = plugins.xmlbuilder2.create;
public create = XmlBuilder.create;
public parseXmlToObject<T = any>(xmlStringArg: string): T {
const parser = new plugins.fastXmlParser.XMLParser({
@@ -22,9 +23,11 @@ export class SmartXml {
ignoreAttributes: false,
attributeNamePrefix: '@_',
format: true,
indentBy: ' '
indentBy: ' ',
});
const xml = builder.build(jsObject);
return '<?xml version="1.0" encoding="UTF-8"?>\n' + xml;
}
}
}
export { XmlBuilder };