Chapter 8. Validating an XML Document with DOM 3 Validation
The DOM 3.0 Validation specification provides a means of dynamically updating the content and structure of XML documents while ensuring schema validity for XML documents. The advantage of DOM 3.0 Validation over validation with a validating parser such as the DOMParser
is the support for dynamic validation. The DOM 3.0 Validation specification implementation retrieves the metadata definitions from the XML schema and provides methods to query the validity of DOM operations—for example the addition and removal of attributes and elements—so that you can validate potential document modifications before actually making them. You would use the parser schema validation, which we discussed in Chapter 3, if the XML document is completely constructed and only the schema validation of the XML document is required. And you would use the DOM 3 Validation if you are constructing or modifying an XML document and you want to validate the different...