@ui5/task-adaptation
Version:
Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment
21 lines • 713 B
JavaScript
import * as convert from "xml-js";
const XML_OPTIONS = { compact: true, spaces: 4 };
export default class XmlUtil {
static jsonToXml(json) {
return convert.json2xml(json, {
...XML_OPTIONS, attributeValueFn: (val) => val
.replaceAll(""", "\"")
.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll("\"", """)
.replaceAll("'", "'")
});
}
static xmlToJson(xml) {
return JSON.parse(convert.xml2json(xml, {
...XML_OPTIONS, attributeValueFn: (val) => val
.replaceAll(""", "\"")
}));
}
}
//# sourceMappingURL=xmlUtil.js.map