XML workflow

XML formatting: well-formedness, whitespace and validation

Format a disposable XML sample to read its structure. Keep the original whenever exact bytes, signatures or text spacing matter.

Content updated: · Maintainer and corrections

Well-formed is a syntax result

XML needs one root element, properly nested case-sensitive tags and quoted attributes. A bare ampersand in text must be escaped as &. A browser parser can detect these syntax errors.

An XML validator may also check a DTD or XSD schema: allowed elements, required fields and data types. This tool performs only the first step. It does not check business rules or establish trust.

Whitespace can be content

In <p>Hello <b>world</b>!</p>, inserting line breaks changes text nodes. CDATA and xml:space="preserve" also signal that automatic whitespace changes are inappropriate. The tool keeps the whole original when it finds any of these cases.

Without a schema, even whitespace between elements may matter to your consumer. Review formatted output against the receiving application. XMLSerializer may change quotes, namespace declarations, empty tags and the XML declaration; this is not XML canonicalization.

Local processing and limits

Input is parsed as XML 1.0 in memory and displayed only as plain text. There is no document upload, URL fetch or input storage. DOCTYPE, ENTITY and xml-stylesheet declarations are rejected, including matching strings inside comments or CDATA.

Limits are 512 KiB input, 10,000 nodes, 100 levels and 2 MiB output. Browser diagnostic wording differs. For DTD, XSD, signatures or larger documents, use your project's approved XML toolchain with an explicit external-resource policy.

<root><item id="demo">Hello &amp; welcome</item></root>

<!-- Preserve mixed content: -->
<p>Hello <b>world</b>!</p>

Data provenance

Sources