Developer guide
How to validate XML syntax
XML syntax validation checks well-formedness, including one root element, matching tags, valid names, quoted attributes, and correctly formed character references.
Open the XML ValidatorWell-formed XML rules
Every XML document needs one root element. Start and end tags must match exactly, including letter case. Attribute values must be quoted, and reserved characters must use valid references when they are data.
Valid structure
<root><item id="1">Text</item></root>
How to validate XML
- Paste XML or open a UTF-8 file.
- Select Validate XML.
- Read the first browser parser error.
- Inspect that location and the nearest opening tag or reference before it.
- Correct the issue and validate again until the report passes.
Error wording and line details vary by browser. The reported position may be where parsing became impossible rather than where the original mistake began.
Common XML syntax errors
| Problem | Example |
|---|---|
| Mismatched case | <Item></item> |
| Unquoted attribute | <item id=1/> |
| Unescaped ampersand | A & B |
| Multiple roots | <a/><b/> |
Use & for a literal ampersand in text and place all top-level content inside one document element.
Syntax validation versus schema validation
A well-formed document follows XML syntax. XSD or DTD validation additionally checks allowed elements, attributes, order, types, and relationships defined by a vocabulary.
The ToolPixels validator checks syntax only. It does not validate XSD, DTD rules, or application requirements, and it does not load external documents.
Practical validation cautions
- Fix the first error before trusting later locations.
- Namespaces can be well-formed but still wrong for an application.
- Standard XML entities and numeric references are supported.
- DTD and custom entity declarations are not supported here.
- Run schema and business validation after syntax passes.
Open the ToolPixels tool
Check XML well-formedness locally and read the browser parser's first error without uploading the document.