Semantics: The second task is to compare an XML document against a formal definition in the form of either a DTD (Data Type Definition) or XML Schema. This ensures that the actual XML document conforms to the semantic restrictions imposed by the DTD or Schema.
The DOM approach parses the entire XML document at once and makes it available, as a whole, to the application that called the DOM parser. (The application can then access the XML hierarchy in exactly the same way that it would access DOM descriptions of HTML pages.)