public static void validateSchema ( final File xsd , final File xml , final ErrorHandler errorHandler ) throws SAXException , ParserConfigurationException , IOException { final Schema schemaXSD = getSchema ( xsd , errorHandler ) ; // Create a Validator capable of validating XML files according to my custom schema. final Validator validator = schemaXSD . newValidator ( ) ; // parse the XML DOM tree againts the stricter XSD schema validator . validate ( getDOMSource ( xml , errorHandler ) ) ; }
Validate xml through xsd .