XML Mismatched Tag – Find Opening and Closing Tag Errors
A mismatched tag error means an element closes with a different name than the element currently open at that nesting level.
Read fixXML error index
Find XML well-formedness problems involving tags, attributes, entities, namespaces, declarations, CDATA, comments, and root structure.
Diagnostic workflow
XML parsers stop on strict well-formedness rules, so begin at the first reported location and verify the surrounding element boundaries. A single missing quote, mismatched tag, or unescaped character can make later markup look broken even when those later elements are correct.
Browse focused fixes
24 troubleshooting pages
A mismatched tag error means an element closes with a different name than the element currently open at that nesting level.
Read fixAn unclosed tag leaves an element open when the parser reaches a parent boundary or the end of the XML document.
Read fixA well-formed XML document has exactly one document element, so two sibling top-level elements cannot both be roots.
Read fixA bare ampersand starts XML entity-reference syntax, so ordinary text containing & must escape it as & unless a valid entity follows.
Read fixA literal less-than sign cannot appear directly in XML character data because < begins markup such as an element, comment, or processing instruction.
Read fixAn XML start tag cannot contain the same attribute name more than once, even when the duplicate values are identical.
Read fixXML requires attribute values to be enclosed in matching single or double quotes, even when the value contains only letters or digits.
Read fixAn XML comment starts with <!-- and must end with -->. Without that terminator, later markup remains inside an unfinished comment and the document cannot parse.
Read fixAn undefined entity error means the parser encountered a named entity reference that XML does not know in the current document.
Read fixXML entity references must end with a semicolon, so a sequence such as & followed by ordinary text is not a complete reference.
Read fixAn invalid character reference points to a code point that XML cannot represent or that falls outside the valid Unicode range.
Read fixXML element names must follow XML name syntax and cannot begin with characters such as ordinary digits.
Read fixA prefixed XML name such as x:item must have the prefix bound to a namespace URI in scope.
Read fixA CDATA section that starts with <![CDATA[ must end with ]]> before XML markup can resume.
Read fixXML comment content cannot contain the double-hyphen sequence --, even when the final --> terminator is present.
Read fixWhen an XML declaration is present, it belongs at the beginning of the XML document rather than after the root element or ordinary content.
Read fixXML may contain prolog markup before the root element, but ordinary character data cannot appear there.
Read fixAfter the single document element closes, ordinary character data cannot continue as a second payload outside the XML tree.
Read fixEvery XML attribute must use a name, an equals sign, and a quoted value.
Read fixA quote matching the attribute delimiter ends the value, so the same quote cannot appear literally inside that value.
Read fixAn extra closing tag appears when the parser encounters </name> but no matching element remains open at that position.
Read fixA document type declaration belongs in the XML prolog before the root element, not in the epilog after it closes.
Read fixA processing instruction that begins with <?target must end with ?> before normal XML markup continues.
Read fixThe exact ]]> sequence is reserved as the end of a CDATA section and cannot appear literally in normal XML character data.
Read fixUnderstand the underlying concepts
1 related guides
Understand XML parsing and well-formedness errors, how to read parser messages, and how tags, entities, attributes, namespaces, and document structure cause validation failures.
Read guide