How to validate xml against xsd and get *ALL* errors?

Spishixetters

New Member
I have a standard code like below to validate xml against xsd, but it throw exception on first error and stops. How to validate xml, but continue on the first and next errors and get them all at the end ? Is it even possible ?\[code\]public static void validate(File xml, InputStream xsd) { try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new StreamSource(xsd)); Validator validator = schema.newValidator(); StreamSource xmlFile = new StreamSource(xml); validator.validate(xmlFile); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }}\[/code\]
 
Back
Top