XML files are everywhere: sitemaps, RSS feeds, invoices, Android apps, GPS tracks and older APIs. Opened in a basic editor they look like a wall of angle brackets. This guide explains how to read them, fix errors and find what you need with the free XML Viewer & Validator.
XML in 60 seconds
<title>The Guide</title>
299
- Elements are the tags:
…. - Attributes sit inside the opening tag:
id="b1". - Text sits between the tags:
The Guide. - There is exactly one root element (
catalog) that contains everything else.
How to open an XML file
Paste the XML into the XML Viewer, or open or drop the file (.xml, .xsd, .svg, .rss, .kml, .gpx, .plist and more). It is shown as a collapsible tree: open and close branches to explore, with tags, attributes and text in different colours. Switch to Formatted for neatly indented text, or JSON to see it as JSON.
The most common XML errors
The viewer checks the file immediately and shows the line and column of the first problem.
| Error | Cause | Fix |
|---|---|---|
| Opening and ending tag mismatch | A tag was closed in the wrong order or not at all | Close tags in reverse order of opening |
| Unescaped & | A plain & in text | Write & |
| Unescaped < | A < inside text | Write < |
| Attribute without quotes | id=b1 | id="b1" |
| Extra content after the root | Two top-level elements | Wrap them in one root |
| Content before the declaration | Space or text before 250] | Prices above 250 |
count(//book) | The number of books | |
//book[1]/title | The first book’s title |
If a document declares a default namespace, use //*[local-name()="title"].
Convert XML to JSON
Modern apps usually prefer JSON. The JSON view converts the document with attributes as @name keys, repeated elements as arrays and mixed text as #text. Download it as a .json file.
Real-world examples
- Sitemaps: check that a sitemap.xml is valid before submitting it to Google. Create one with the XML Sitemap Generator.
- GPS tracks: count the points in a GPX file with
count(//*[local-name()="trkpt"]). - APIs: pretty-print a SOAP response and pull out a status field.
Large files
Big exports can contain tens of thousands of elements. The tree view shows the first few thousand nodes so the page stays fast; use XPath to jump straight to what you need instead of scrolling, or collapse branches you don’t need.
Quick checklist
- One root element.
- Every tag closed, in the right order.
- Special characters escaped.
- Attribute values in quotes.
Open your file in the XML Viewer & Validator, or work with JSON in the JSON Formatter.



