Note: this function is intended to be used by microservices, based on
ut-microservice, that's why its signature may look a bit complicated. For more information, see ut-microservice/xml.md
Create template files in a folder, by using the following naming convention:
name1.parse.xml- create a handler namername1for parsing XML to JSONname2.render.xml- create a handler namedname2for rendering JSON to XML
const xjx = require('ut-function.xjx');
async function test() {
const handlers = (await xjx(fs, __dirname))();
await handlers.name1({payload: xml}); // will return object from the parsed XML
await handlers.name2(params, $meta); // will return XML string
}See index.test.js for more details.