XML Formatter API
Validate XML, then pretty-print it with consistent indentation or minify it. Errors report the line and column.
POST /api/v1/tools/xml-formatterMCP xml_formatterData & ConversionPretty print, validate or minify XML in your browser. Choose the indentation, optionally strip comments, and see the line and column of any XML error.
Input
Send these as a JSON object. Unknown fields are rejected.
- input
- The XML. (string, required)
- mode
- format (pretty-print) or minify. (string, one of format, minify, default "format")
- indent
- Indentation when formatting: "2", "4" or "tab". (string, one of 2, 4, tab, default "2")
- stripComments
- Remove <!-- comments -->. (boolean, default false)
curl https://pithlab.com/api/v1/tools/xml-formatter \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"input":"<catalog><book id=\"1\"><title>Dune</title><year>1965</year></book></catalog>"}'Example response
{
"ok": true,
"result": {
"output": "<catalog>\n<book id=\"1\">\n<title>Dune</title>\n<year>1965</year>\n</book>\n</catalog>"
}
}