XML response validation

Our application generates XML responses to web queries. I know you can change the xml to json to verify content, however we have an XSD I would like to validate the response to. Is there any way to do this in postman? Converting the XSD to a json schema is not an option for us.

Hi.

I do not fully understand your concern. So you have an XSD as a request and want to validate the XML response, is that?

Maybe you can try to first convert XSD to XML and then execute the request. There is an online tool to convert it : http://xsd2xml.com/

Hope that helps.

Hi @swh127!

Welcome to the community! :clap:

So for working with XML, I would suggest using the cheerio.js library. That should be very helpful for at least parsing out XML. You can check out a video I did with cheerio.js and xml in Postman here:

As for validating against the xsd, I’m afraid that I dont see any libraries in the sandbox that would allow for that :frowning: They all seem to be only for json schema validation.

Here is a list of the libraries used in the postman sandbox:

https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/

Its possible to import libraries, although its not a supported or recommended. But if you can import xml.js or other xml libraries, that should help the most.

Other than that, I am not 100% certain that cheerio,js can’t validate XML with an xsd, but from my experience with it so far, I haven’t seen that it can, nor have a tried, so it might be worth looking into.

Hope this helps!