XML validation is the process of checking a document written in
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
(eXtensible Markup Language) to confirm that it is both
well-formed and also "valid" in that it follows a defined structure. A well-formed document follows the basic syntactic rules of XML, which are the same for all XML documents.
A valid document also respects the rules dictated by a particular
DTD or
XML schema
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed by XML itself. These constra ...
.
Automated tools –
validator
A validator is a computer program used to check the validity or syntactical correctness of a fragment of code or document. The term is commonly used in the context of validating HTML,Tittel, Ed, and Mary C. Burmeister. HTML 4 for Dummies. --For d ...
s – can perform well-formedness tests and many other validation tests, but not those that require human judgement, such as correct application of a schema to a data set.
Standards
* OASIS CAM is a standard specification that provides contextual validation of content and structure that is more flexible than basic schema validations.
*
Schematron
Schematron is a rule-based validation language for making assertions about the presence or absence of patterns in XML trees. It is a structural schema language expressed in XML using a small number of elements and XPath.
In many implementations ...
, a method for advanced XML validation.
Tools
* ''
xmllint'' is a command line XML tool that can perform XML validation. It can be found in
UNIX
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
/
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
environments.
* XML toolkit
The XML C parser and toolkit of Gnome– libxml includes xmllint
XML Validator OnlineValidate your XML data.
XML Schema ValidatorValidate XML files against an XML Schema.
References
:*
; Articles discussing XML validation
DEVX March, 2009 - Taking XML Validation to the Next Level: Introducing CAM
XML
Data modeling languages
{{markup-languages-stub