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.

ParserMessage
libxml2 / xmllintStartTag: invalid element name
Firefox DOMParserXML Parsing Error: not well-formed
Python ElementTreenot 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

Triggers the error
<condition>if (count < 5) alert()</condition>
Corrected
<condition>if (count &lt; 5) alert()</condition>

How to fix it

Replace it with `&lt;`, 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 `&gt;` 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.

Input
WaitingPaste a document to check it. Validation runs as you type.

Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.

Tools that catch this

Background reading

Errors this fixes

Every XML error, explained