∟XMLReaderValidator.java - Validating XML with XSD using Xerces-J
This section provides a tutorial example on how to download and install Xerces-J, and how to write a Java program to use the XMLReader interface implemented in Xerces-J to validate an XML against it linked XSD schema file.
Unfortunately, I couldn't find any XML parsers provided in J2SDK 1.4.1_02 that
can validate XML structure against XSD rules. So I downloaded one of the most
popular XML parsers in the public domain, xerces-j 2.3.0, at:
http://xml.apache.org/dist/xerces-j.
Once I downloaded Xerces-J-bin.2.3.0.zip, I unzipped it into \local\xerces-2_3_0
directory. Make sure that xercesImpt.jar is in that directory.
Now I am ready to write a simple Java program to use "org.apache.xerces.parsers.SAXParser"
to validate any XML files against the specified XSD files: