xml2js is also available in the Postman sandbox and gives you a lot more control over the output.
For example…
let respBodyXML = pm.response.text();
let parseString = require('xml2js').parseString;
parseString(respBodyXML, {
ignoreAttrs: true,
explicitArray: false,
}, function (err, result) {
console.log(result);
});
This produces output like the following. It removes the $ signs, and looks more like a proper JSON object.
It depends on how complex your XML is, but have a look here (scroll to the bottom) for all of the formatting options.
Have a look here for another topic that shows some of the formatting options in action.
How to retrieve the names of xml tags - Help - Postman Community