UNPKG

@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
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("&quot;", "\"") .replaceAll("&", "&amp;") .replaceAll("<", "&lt;") .replaceAll("\"", "&quot;") .replaceAll("'", "&apos;") }); } static xmlToJson(xml) { return JSON.parse(convert.xml2json(xml, { ...XML_OPTIONS, attributeValueFn: (val) => val .replaceAll("&quot;", "\"") })); } } //# sourceMappingURL=xmlUtil.js.map