Validating an XML Document
The following code shows you how to use the DOMImplementationLS and DOMConfiguration classes to validate an XML document only when an XML Schema is present: DOMImplementationLS DOMiLS=null;//get a LSParserLSParser LSP=DOMiLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS,