Fix an XML opening and ending tag mismatch
Published by XSDHub · How our guides and examples are made
The quick fix
Match each closing tag to the most recent opening tag that has not yet been closed. In our example, itemz must be item. XML names are case-sensitive: Item and item are different names. Fix the source XML rather than changing the schema.
A broken example and a working correction
These examples were checked on 26 October 2026 using XSDHub’s libxml2-based engine. Other validators may phrase the same problem differently.
What XSDHub reports
Opening and ending tag mismatch: item line 2 and itemzThe buttons open a new workbench page with the example loaded. Choose Validate XML to run the check. Your own files are not uploaded.
Read the first mismatch
XSDHub reports the opening name and the unexpected closing name. Inspect both lines and the enclosing element. A missing close tag earlier in the document can cause a mismatch later, so the reported line is a starting point rather than proof that only that line is wrong.
Check nesting as well as spelling
Closing names may all exist and still be in the wrong order. <a><b></a></b> is malformed; close b before a. An empty element can use <b/> or the pair <b></b>. Do not remove content simply to make a parser accept the file.
Prevent the error at its source
Generate XML with an XML serializer rather than assembling strings. If this came from an export, repair the template or generator and regenerate the document. Check a small failing sample before processing a batch.
What a successful check means
A syntax pass confirms well-formed XML. It does not verify element order, required fields or data types against an XSD. After repairing syntax, run schema validation if your receiver provides a schema.
Checking the same rule across many files?
Start with the free single-document check. Pro adds batches of up to 25 XML files and 10 saved schemas; Team adds larger batches and a shared library. Both use the same validation engine.
Compare batch-validation plans →