Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Validation of the XML document is sometimes required as part of the business process to guarantee reliability of the application. Validation is the process of verifying that an XML document is an instance of a specified XML schema. An XML schema defines the content model (also called a grammar or vocabulary) that its instance documents represent. Some of the popular XML schema include Document Type Declaration (DTD), W3C XML Schema, and RELAX NG. By default, the parsers are set to be nonvalidating but can be easily configured to be validating. Even though Web services are based on XML schema and do not support DTDs, processing of DTD-based XML documents are widely used and hence discussed here for completeness.
Validation is an expensive process, since the parser needs not only to parse an XML document but also to parse the schema document, build an in-memory representation of this schema, and then use this internal schema representation to validate the XML document.