Sunday 13 November 2011

What is XML validation and what is the output?


XML validation is the process by which a document is checked to ensure the document is a well-formed XML document, and also that it’s structure corresponds to it’s declared Document Type Definition ( DTD ) or XML Schema. If a document is not well-formed, it cannot be valid.

An XML parser can be either validating or non-validating, depending on it’s ability to validate an XML document against a DTD or an XML Schema. A non-validating XML processor will only check for correct syntax, and interrupt parsing at the first encountered error. A validating parser will first perform the well-formedness test, and then proceed ( if the document is a well-formed XML document ) to check whether the contents match the description in the DTD/XMS. Unlike the well-formedness test, a validating parser is free to choose the course of action when validity errors are encountered; the parser can simply stop parsing and exit, or it could notify the user of the error and then continue parsing.

The output of an XML validator depends on the implementation; the XML standard allows for some flexibility in this regard. It would most likely consist of a list of errors encountered, such as the w3schools validator (http://www.w3schools.com/xml/xml_validator.asp ).