XML error reference · XV006
Unescaped less-than sign
A raw < appears in text content, where it is read as the start of a tag.
What your parser calls it
The same problem, reported differently by each parser. If you arrived here from one of these strings, you are in the right place.
| Parser | Message |
|---|---|
| libxml2 / xmllint | StartTag: invalid element name |
| Firefox DOMParser | XML Parsing Error: not well-formed |
| Python ElementTree | not well-formed (invalid token): line 1, column 21 |
What causes it
`<` is markup, not data. When it is followed by something that is not a valid element name, a comment, a CDATA section or a processing instruction, the parser reports a syntax error. This typically comes from embedding code, arithmetic such as "if x < 5", or unescaped HTML in an element's text.
See it happen
<condition>if (count < 5) alert()</condition><condition>if (count < 5) alert()</condition>How to fix it
Replace it with `<`, or wrap the whole block in a CDATA section if it contains a lot of markup-like text. Note that `>` is legal in content and strictly needs escaping only in the sequence `]]>`, though escaping it as `>` is harmless and often clearer.
Fix your own document
Paste your own document below. Press Sample if you want the broken example above loaded instead. Nothing you paste leaves this tab.
XML Validator
Well-formedness and schema validation. Nothing is uploaded.
Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.