Reference
XML parsing errors
Every XML parser words the same defect differently. Each page explains one real failure, shows a broken and a fixed document, and lists how Xerces, expat, .NET and Go phrase it — including the cases permissive parsers accept outright.
Any parser — libxml2, Xerces, expat, .NET, Go. A whole stack trace is fine. Nothing is sent anywhere; the matching happens in your browser.
Every documented error
27 well-formedness failures, each with the exact message XMLDir reports and the equivalent from the other parsers.
Opening and ending tag mismatch
structureOpening and ending tag mismatch: item line 2 and channel (line 4)An element was closed out of order: the parser met an end tag for an ancestor while a child was still open, so the tree cannot be built at all.
Premature end of data in tag
structurePremature end of data in tag urlset line 1 (line 2)The document ended while one or more elements were still open — almost always truncation, not an authoring mistake.
Extra content at the end of the document
structureExtra content at the end of the document (line 2)Something follows the root element — a second root, a stray closing tag, or a fragment that was never a whole document.
Unescaped ampersand (EntityRef: expecting ';')
entityEntityRef: expecting ';' (line 2)A bare & appeared in content. XML reads it as the start of an entity reference and expects a name and a semicolon.
Entity is not defined
entityEntity 'nbsp' not defined (line 1)An HTML entity was used in XML. Only five are predefined; anything else must be declared in a DTD or written as a numeric character reference.
Start tag expected
syntaxStart tag expected, '<' not found (line 1)What arrived is not XML — an HTML error page, a JSON body, or plain text served under an XML content type. The parser found no opening tag.
XML declaration allowed only at the start of the document
prologXML declaration allowed only at the start of the document (line 2)Whitespace precedes the XML declaration. A single blank line, or one space, before it is enough to make the document not well-formed.
Unquoted attribute value (AttValue expected)
attributeAttValue: " or ' expected (line 1)An attribute value is not quoted. XML requires quotes around every value, including numbers — unlike HTML, which accepts bare values happily.
Attribute redefined
attributeAttribute href redefined (line 1)The same attribute name appears twice on one element, which XML forbids outright. HTML silently keeps the first; XML refuses the document.
Attributes construct error (unterminated quote)
attributeattributes construct error (line 1)An attribute value was opened with a quote that is never closed, so the parser runs past the end of the tag looking for the matching one.
Invalid element name
syntaxStartTag: invalid element name (line 2)An element name breaks XML's naming rules — usually because it starts with a digit, contains a space, or uses punctuation XML reserves.
Document is empty
syntaxDocument is empty (line 1)Nothing arrived at all. Almost always a transport problem — a 204, a dropped connection, or a fetch that succeeded against the wrong URL.
Unsupported encoding
prologUnsupported encoding: UTF-9 (line 1)The declaration names an encoding the parser cannot decode — a typo, a vendor-specific label, or a charset the build of libxml2 was not compiled with.
Sequence ']]>' not allowed in content
syntaxSequence ']]>' not allowed in content (line 2)The three characters ]]> are reserved as the CDATA terminator and cannot appear literally in element content, even outside a CDATA section.
Comment not terminated
syntaxComment not terminated (line 3)A comment was opened with <!-- and never closed, so the rest of the file is swallowed as comment text and the reported line is the end, not the fault.
Detected an entity reference loop
entityDetected an entity reference loopTwo declared entities refer to each other in a cycle. The parser stops rather than expand forever — the same guard that blocks a billion-laughs attack.
PCDATA invalid Char value (control character)
syntaxPCDATA invalid Char value 1 (line 2)A raw control character reached element content. XML 1.0 forbids most of them, and no escaping makes them legal — they must be removed at the source.
Unescaped '<' in an attribute value
attributeUnescaped '<' not allowed in attributes values (line 2)A literal < inside an attribute value. XML forbids it there because the parser cannot tell it from the start of a tag, so it must be written <.
Invalid numeric character reference
entityxmlParseCharRef: invalid xmlChar value 0 (line 2)A numeric character reference points at a code point XML does not allow — usually � or another control character that escaping cannot make legal.
Blank needed here
prologBlank needed here (line 1)Two parts of the XML declaration ran together with no space between them. Terse enough to be baffling, and it always means the same thing.
Malformed declaration expecting version
prologMalformed declaration expecting version (line 1)The document opens with <?xml but no version attribute. Version is the one part of the declaration that is not optional, and it must come first.
Unsupported XML version
prologUnsupported version '2.5' (line 1)The declaration names an XML version that does not exist. There are only two — 1.0 and 1.1 — and in practice you want 1.0 unless you know otherwise.
Processing instruction not terminated
syntaxParsePI: PI target never end ... (line 2)A processing instruction was opened with <? and never closed with ?>. Everything after it is consumed as instruction data until the file runs out.
CData section not finished
syntaxCData section not finished (line 3)A CDATA section was opened and never closed with ]]>, so the rest of the document — closing tags included — was read as literal text inside it.
Error parsing attribute name
attributeerror parsing attribute name (line 2)A start tag was never closed with >, so the parser kept reading and found the next element's markup where an attribute name should have been.
Double hyphen within comment
syntaxDouble hyphen within comment: <!-- a (line 2)XML forbids -- inside a comment's body, even when the comment is otherwise closed properly. It is one of the specification's genuinely surprising rules.
CharRef: invalid decimal value
entityCharRef: invalid decimal value (line 2)A numeric character reference was opened with &# and never closed with a semicolon, so the parser read past the digits into text that is not a number.
Well-formed is not the same as valid
Every error on this page is a well-formedness failure: the document cannot be parsed into a tree at all. A document that parses cleanly can still break a schema, a business rule, or a search engine’s expectations — that is validation, and it is a separate step. Check the first with the XML validator, and the second with the XSD validator.
Schema failures have their own reference: XSD validation errors covers the documents that parse perfectly and are still rejected — including the cvc- codes Xerces reports.
Get started
Paste the document that is failing.
XMLDir reports libxml2's parse error with its line number, keeps the document so you can compare it against a version that worked, and extracts the structure of the ones that parse.