XML Formatter API
Category: developer
Pretty-print, minify, and validate XML documents. Runs entirely in the browser.
Endpoint
N/A
Browser API (DOMParser)
No Server API
Response
Content-Type: N/A
This tool processes XML in the browser using DOMParser. No server-side API is available.
// Browser-only: uses DOMParser
cURL Example
# No cURL equivalent — this tool runs in the browser
Code Samples
// XML formatting using DOMParser const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const serializer = new XMLSerializer(); const formatted = serializer.serializeToString(xmlDoc);
# For server-side XML processing: import xml.dom.minidom dom = xml.dom.minidom.parseString(xml_string) formatted = dom.toprettyxml(indent=' ') print(formatted)
// For server-side XML processing: // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // DocumentBuilder builder = factory.newDocumentBuilder(); // Document doc = builder.parse(new InputSource(new StringReader(xml)));