Quick answer
Before an XML document can be validated against an XSD schema, it must be well-formed.
Invalid XML Instance
Before an XML document can be validated against an XSD schema, it must be well-formed. Unclosed tags, wrong nesting, or invalid characters cause the parser to fail before schema validation runs.
Common causes
- Unclosed tag or mismatched closing tag in the XML instance.
- Invalid characters or unescaped content in attribute values.
- Missing or malformed XML declaration or encoding issues.
How to fix
- Validate the XML as well-formed first with an XML validator.
- Fix all reported line/column errors (unclosed tags, mismatched names, invalid attributes).
- Then run XSD validation again with the corrected XML.
Examples
Bad
<root> <item>value </root>
Good
<root> <item>value</item> </root>
FAQ
- Do I need to fix XML before XSD validation?
- Yes. The validator must parse the XML first; if it is not well-formed, schema validation cannot run.
- What is well-formed XML?
- Single root element, every opening tag has a matching closing tag, attributes are quoted, and no invalid characters.
Fix it now
Try in validator (prefill this example)