Example with no configuration
const XMLParser = require("fast-xml-parser/v5/XMLParser")
const parser = new XMLParser();
//read xmlData your own
let result = parser.parse(xmlData, true);
The default response of parse is built by JsObjOutputBuilder
. FXP v5 comes with 2 more output builders. And you can set your custom output builder too to customize the output.
const JsObjOutputBuilder = require("fast-xml-parser/v5/OutputBuilders/JsObjBuilder");
const parser = new XMLParser({
OutputBuilder: new JsObjOutputBuilder()
});
//read xmlData your own
let result = parser.parse(xmlData, true);