Create an XSDBuilder object and invoke the build(Input Source) method of the XSDBuilder object to obtain an XMLSchema object.The Input Source object is created with an Input Stream object created from the example XML schema document,
The validator will report fatal errors, non-fatal errors and warnings.
In other words, it can tell you whether the document is valid.
If validation is not activated, however, it can only tell whether or not the document is well-formed, as was shown in the previous section when you deleted the closing tag from an XML element.
The application allows the user to select an XML file and have it validated against an XSD schema file.
In this example, the SAX reader parses the sample XML file (books.xml), and writes validation results as output to a textbox control on the main form for the application.