XML Formatter & Validator
Format, validate, and analyze XML documents with comprehensive options
Input & Settings
Formatted XML
Formatted XML will appear here
Analysis & Stats
Validation statistics will appear here
• Well-formed: Proper tag nesting and closing
• Valid: Conforms to DTD/Schema rules
• Case-sensitive: Tags and attributes
• Single root: One top-level element
XML Examples & Use Cases
Simple Structure
Basic XML with elements and text content.
<person>\n <name>John Doe</name>\n <age>30</age>\n <active>true</active>\n</person>With Attributes
XML elements with attributes for metadata.
<book id="123" category="fiction">\n <title lang="en">Sample Book</title>\n <author nationality="US">John Author</author>\n</book>Details
This tool helps you format and validate XML (Extensible Markup Language) documents. XML is widely used for storing and transporting data, especially in configuration files, web services (SOAP), and data exchange between systems. The formatter makes your XML human-readable with proper indentation, while the validator checks for well-formedness and can validate against XML schemas.
Examples
Basic XML Formatting
<!-- Before formatting -->
<root><element attribute="value">Text</element><element>More text with <child>nested element</child></element></root>
<!-- After formatting -->
<root>
<element attribute="value">Text</element>
<element>
More text with
<child>nested element</child>
</element>
</root>Transforms a compact, hard-to-read XML document into a properly indented format with clear hierarchical structure.
XML Validation
<!-- Invalid XML (Missing closing tag) -->
<person>
<name>John Doe</name>
<age>30</age>
<email>john@example.com
</person>
<!-- Error Message -->
Error at line 5: Element 'email' is not closedValidation detects common XML errors such as missing closing tags, invalid nesting, or malformed syntax.
XML with Namespaces
<!-- Before formatting -->
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"><soap:Header><auth xmlns="http://example.org/auth"><username>user</username><password>pass</password></auth></soap:Header><soap:Body><m:GetStockPrice xmlns:m="http://example.org/stock"><m:StockName>IBM</m:StockName></m:GetStockPrice></soap:Body></soap:Envelope>
<!-- After formatting -->
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">
<soap:Header>
<auth xmlns="http://example.org/auth">
<username>user</username>
<password>pass</password>
</auth>
</soap:Header>
<soap:Body>
<m:GetStockPrice xmlns:m="http://example.org/stock">
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>Formats complex XML with namespaces, common in SOAP web services and enterprise applications.