public static void validate ( InputStream xml , InputStream xmlSchema , String humanFriendlyDocumentType ) throws IOException { try { newXmlSchemaValidator ( xmlSchema ) . validate ( new StreamSource ( Objects . requireNonNull ( xml ) ) ) ; } catch ( SAXException e ) { throw new ValidationException ( "Invalid " + humanFriendlyDocumentType , e ) ; } }
Validate an XML document against an XML Schema document .