UTILITIES NEWBIE

Digital tools

XML parser and serializer

Check XML syntax and reserialize the supported document tree without changing mixed text by inserting indentation.

Input

Import a local text file

0 UTF-16 code units

Optional local draft

Saving stores a plaintext draft in this browser on this device. Do not save secrets or use this on a shared device. Nothing is saved or loaded automatically. Reset does not delete a saved draft; use Delete local draft.

No draft has been loaded.

Output

Quotes change; values stay. Full explanation follows.
id='007' -> id="007". Text explanation

The checked attribute changes from single to double quotes while retaining the string 007. The ampersand is represented as & in serialized XML. Serialization normalizes markup spelling without promising byte identity or adding whitespace throughout mixed content.

Serialize an XML specimen without pretending to preserve every byte

Choose serialization rather than whitespace beautification

This XML Formatter parses supported XML and serializes the document again. It normalizes aspects of markup spelling while retaining the ordered document content represented by its node model. It is not the same operation as adding indentation to every element. If the source already contains meaningful text or whitespace, those characters remain part of the represented content. Start by deciding whether you need normalized serialization, a separate beautification operation or an application-specific XML check. A formatted result is source text to review, not automatic permission to replace the original file.

A useful task is inspecting a small synthetic export whose quotes and entity spellings make manual comparison awkward. The parser distinguishes markup from text and attributes rather than treating XML as a set of unrelated angle-bracket substitutions. It requires a supported well-formed document with one root. The result can change how an empty element or quoted attribute is written without changing the represented value. That is why an exact source-file comparison and a comparison of parsed content answer different questions. Keep the original file when either kind of fidelity matters to your workflow.

This page supplies XML serialization under the structured-data workspace. It does not perform XSD, DTD, SOAP, WSDL or RSS semantic validation. It does not fetch external resources or resolve custom entities. A passing conversion cannot establish that a receiving application accepts the document's element names, required fields or business meaning. If your task depends on a schema, signature or protocol-specific contract, retain that separate test. Do not describe a successful local format operation as a complete XML certification or a check of the system that will eventually consume it.

Compare attribute quoting and decoded text

Checked synthetic input

<root><item id='007'>tea &amp; cake</item></root>

Exact observed output

<root><item id="007">tea &amp; cake</item></root>

The worked input contains a root with an item whose id attribute is written with single quotes around 007. The item's text contains an ampersand represented as &amp;. The checked serialized result uses double quotes around the attribute while keeping the identifier textual and retaining the represented ampersand in XML form. The exact source and output below make that change visible. The diagram separates normalized markup spelling from content values so that a quote-style change is not confused with converting the identifier into a number or changing the displayed words.

A second checked case shows an empty element written with an explicit opening and closing pair. Serialization returns a self-closing element. Those spellings differ as source text, but the node model represents the same empty element in this specimen. Do not infer that every textual difference is harmless in every external workflow, however. A signed or byte-sensitive document can depend on a representation contract beyond this formatter. This operation is not XML canonicalization. Review any required signature, hashing or archival procedure with the tools and rules that actually define that procedure.

Text around child elements is another important fixture. The checked paragraph before a bold child and after it retains those surrounding text segments and their spaces. Comments and CDATA are represented as their own ordered nodes rather than silently treated as ordinary element names. The formatter does not indiscriminately add indentation between mixed text and elements. If you want additional visual indentation, inspect the separate beautifier's preservation policy rather than assuming the word formatter means every line will be reflowed. Preserve a small mixed-content example whenever the consuming application depends on exact text boundaries.

Respect the supported XML and resource limits

The XML processor supports its documented XML 1.0 profile with one root, bounded at 100,000 input UTF-16 code units, 10,000 nodes and attributes, 40 element levels and 1,000,000 output characters. These counters are implementation limits, not universal XML limits or a performance promise for every receiver. Optional local text-file import has a separate 100,000-byte cap. A file's UTF-8 byte length need not equal its displayed character count. Keep the unit attached to a failure report and reduce a specimen deliberately rather than truncating it into a different document without recording the edit.

DTD declarations, custom entity definitions and external resources are rejected rather than fetched or expanded. Unbound namespace prefixes, duplicate attributes, mismatched tags, forbidden control characters and multiple roots are also rejected in the checked profile. A namespace prefix is not a license to invent an undeclared binding. At the same time, a supported namespace declaration does not cause the parser to download a schema from its name. Namespace syntax and application-level vocabulary validation are separate responsibilities. Do not use a local parse result as evidence that a remote service or external definition was consulted.

XML normalization can change source details. Line endings and literal attribute whitespace follow the parser's normalization, and declaration or processing-instruction spacing can be normalized. Output encoding declarations use UTF-8; text imported into the page must already have been decoded correctly. The parser does not transcode arbitrary file byte encodings based on a declaration embedded in an already decoded string. Comments and CDATA can remain represented while original quote choices and other lexical details differ. Those limits make an original source copy essential when forensic, archival or round-trip requirements extend beyond the supported node representation.

Use a reviewable handoff instead of a blind replacement

For a small exported fragment, keep the original, run serialization on a copy and compare meaningful attributes, child order and text segments. Include an empty element and a mixed-content line if those features occur in the real document. Review the exact output in the receiving context rather than assuming that a syntactic pass checks all downstream requirements. Copy and Download transfer generated XML text; they do not update a repository, validate a protocol exchange or confirm that an application stored the result unchanged. Record those later steps separately when they matter.

For a failed input, preserve the error and the smallest source that still reproduces it. A mismatched close, undeclared prefix or unsupported entity can be investigated independently without removing unrelated content from the authoritative file. Change one feature at a time and save the corrected specimen alongside the original failure. A later successful result should not erase the reason the first version failed. If the document genuinely needs an unsupported feature, use an appropriate parser and safe authorized environment rather than trying to disguise the feature to make this page accept it.

For documentation, explain the difference between a normalized representation and byte preservation. Show the checked quote change explicitly, retain the actual source and result, and use the accessible diagram explanation to make the content boundary understandable without an image. The useful conclusion is narrow: this specimen was accepted and serialized under the documented XML profile. Schema compatibility, application semantics, signatures, security and publication remain separate questions. Keeping those boundaries visible makes the formatter a reliable aid to a controlled review instead of a misleading substitute for the whole workflow.

Supporting reference: XML language context; local subset and normalization described above.

Related existing tool: xml to json.

Worked examples

Input and settings

<note priority='high'>Hello &amp; goodbye</note>

Expected output

<note priority="high">Hello &amp; goodbye</note>

The attribute is serialized with double quotes. Content order and meaningful text spacing are retained; this conservative formatter does not insert new indentation into mixed content.

Related tools

XML to ordered JSON tree · HTML structural checker · JSON Formatter & Beautifier

Find a tool

Type a tool name, such as JSON or percentage.

Quick links

Browse by category

All tools