Lint and Cleanup

XML Well-Formed vs Valid Guide

Understand the difference between well-formed XML syntax and schema-valid XML before debugging integrations, feeds or SOAP messages. Last updated September 15, 2026.

Understand the difference between well-formed XML syntax and schema-valid XML before debugging integrations, feeds or SOAP messages. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.

Recommended workflow

StepWhy it matters
Parse firstA schema validator cannot help until the document is readable XML.
Validate secondOnly after parsing should you check XSD-required elements, attributes and types.
Compare contractsIntegration bugs often come from using an old schema or undocumented partner change.
Document unsupported casesRecord which optional fields your system intentionally ignores.

Starter snippet

Well-formed: parser can read the XML
Valid: XML also satisfies DTD or XSD rules

Review checks

Common mistakes

Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.

Related Formalint references

Continue with XML Lint Error, Xml Schema Xsd Guide, Api Request Body Validation Guide.