Please explain in naive terms.
What does it actually mean by XML Validation?
Do “validation of XML data”, “validation of XML document” and “validation of XML schema” mean same thing?
How XSD documents help in validating an XML Document/Data/Schema?
NOTE: There are lots of articles available about XML Validation. But, those are convoluted. Discussions use jargons and consequently incomprehensible.
Maybe this simple explanation helps:
There are different levels of “correctness” for an XML document.
First comes well-formedness. A document is well-formed if it conforms to the syntactic rules laid out for XML files, e. g. tags are correctly nested and closed, naming rules are followed etc.
An XML document can be checked for well-formedness purely based on the XML standard(s). You don’t need to know anything about the data contained in the XML document and its structure.
This is where validation comes in:
A DTD (document type definition) or XSD specifies the rules how to build a certain type of XML document, for example which tags are allowed in which context, which attributes and values are possible for each tag, and whether cross-references between tags are handled correctly.
For example, if you define a tag as an ID field, its value may only be present once in the XML file.
Compare this to a programming language:
In Python, the following would be a
SyntaxError:The following is syntactically correct but still fails because the function is used incorrectly: