An XML document has to be validated against the XML schema. A DOM can be used to validate XML documents against the XML schema. A DOM ensures proper grammar and proper formation of the XML document and closely mirrors typical hierarchical and relational database structured.
The DOMDocument object is the main object in a DOM. This object represents the top node in every document tree. You can use the DOMDucument object to load an XML document, parse it, and validate it. In case of error, you can use the properties of the IXMLDOMParseError object, which help display the appropriate message. In addition these objects, you require another object called XMLSchemaCache to load the schema document associated with the XML document.