XML Validator
Validate XML well-formedness and optionally check against an XSD schema.
POST
1 credit
/v1/xml-validate
curl -X POST "https://devtools.toolkitapi.io/v1/xml-validate" \
-H "Content-Type: application/json" \
-d '{"data": "<book><title>Dune</title><author>Herbert</author></book>"}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/xml-validate",
json={"data": "<book><title>Dune</title><author>Herbert</author></book>"},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/xml-validate", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"data": "<book><title>Dune</title><author>Herbert</author></book>"}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
{
"valid": true,
"well_formed": true,
"as_json": {
"book": {
"title": "Dune",
"author": "Herbert"
}
}
}
Try It Live
Live Demo
Response
Description
Validate XML well-formedness and optionally check against an XSD schema.
How to Use
1
1. Send a POST request with the `data` field containing your XML string.
2
2. Optionally include an `xsd` field with an XSD schema string to validate the document structure.
3
3. Check `well_formed` for syntax correctness and `valid` for schema compliance (when XSD is provided).
About This Tool
XML Validator checks whether an XML document is well-formed and optionally validates it against an XSD schema. It also converts the XML into a JSON representation for easy downstream processing.
Why Use This Tool
- XML syntax checking — Catch malformed tags, unclosed elements, or encoding issues
- Schema validation — Verify XML documents comply with an XSD before processing
- XML to JSON conversion — Convert XML payloads to JSON for REST APIs
Frequently Asked Questions
How does the JSON conversion work?
Elements become object keys, nested elements become nested objects, and attributes are stored under `@attributes`. Text-only elements become string values.
What XSD versions are supported?
The validator uses `lxml` which supports XSD 1.0 (W3C XML Schema).
Start using XML Validator now
Get your free API key and make your first request in under a minute.