How to Validate & Format XML Online Safely (Fix Syntax Errors Locally)
By Rohit Kumar · Updated 2026-11-28 · 5 min read
A single unescaped ampersand or mismatched closing tag breaks an entire sitemap.xml, Maven pom.xml, AndroidManifest.xml, or SOAP API payload. Instead of pasting internal configuration files into cloud validators, you can validate, inspect element depth, and pretty-print XML locally inside your browser in milliseconds.
Free Browser Tools Used in This Guide
- XML Formatter & Validator — Pretty-print, minify, and validate XML documents using the native browser DOMParser.
- JSON Formatter, Validator & Converter — Prettify, minify, validate JSON with error diagnostics, and export to CSV or YAML.
- HTML Entity Encoder & Decoder — Escape <, >, &, and quotes into safe HTML entities or decode entities back to plain text.
The 5 Most Common XML Validation Errors (And How to Fix Them)
Unlike HTML, XML enforces strict well-formedness rules: every opening tag must match its closing tag case-sensitively, all attribute values must be wrapped in quotes, and special characters inside text nodes must be escaped.
When Google Search Console reports "Sitemap couldn’t fetch" or "XML parsing error," the culprit is almost always an unescaped `&` inside a URL query string or stray whitespace before the `<?xml version="1.0"?>` declaration.
| Error Symptom | Root Cause | Exact Fix |
|---|---|---|
| xmlParseEntityRef: no name | Raw & inside URL or text | Replace & with & |
| Opening and ending tag mismatch | Wrong nesting or letter case | Match exact tag spelling/case |
| Extra content at end of document | Two top-level root elements | Wrap everything in one root tag |
| XML declaration allowed only at start | Blank line or BOM before <?xml | Remove leading whitespace |
How to Validate, Pretty-Print & Minify XML in Tooltable
Paste your raw or minified XML into Tooltable’s XML Formatter & Validator. The built-in structural inspector runs immediately and displays a clear green Valid XML or red Invalid XML status badge along with the root tag name, element count, attribute count, and maximum nesting depth.
- Choose 2-space or 4-space indentation for clean diffs in Git commits.
- Inline leaf text elements like `<name>Tooltable</name>` stay on a single line instead of exploding across three lines.
- Click Minify XML to strip redundant whitespace before deploying feeds or sitemaps.
- Click Download .xml to save the cleaned file directly to your machine.
Pro Tip: If your XML embeds API keys, internal hostnames, or customer addresses, always validate offline—Tooltable sends zero bytes over the network.
Validating Sitemaps Before Submitting to Google Search Console
Always run your generated `sitemap.xml` through a strict XML validator before uploading it to production. Confirm the root tag is `urlset` (or `sitemapindex`), verify zero parser errors, and ensure every `<loc>` URL uses `&` for query parameters.
Frequently Asked Questions
Why does Google Search Console reject my XML sitemap?
Common causes include unescaped & characters in URLs, trailing text outside the root <urlset> tag, incorrect Content-Type headers, or stray spaces before <?xml version="1.0"?>.
Does formatting XML change any data values or attributes?
No. Proper XML formatting only adjusts whitespace between tags while preserving inline leaf text values and attributes intact.
Is it safe to paste SOAP responses or config XML here?
Yes. Validation and formatting run 100% client-side in your browser RAM with zero server transmission.