public static void validateAgainstSchema ( final String sbeSchemaFilename , final String xsdFilename ) throws Exception { final ParserOptions . Builder optionsBuilder = ParserOptions . builder ( ) . xsdFilename ( System . getProperty ( VALIDATION_XSD ) ) . xIncludeAware ( Boolean . parseBoolean ( System . getProperty ( XINCLUDE_AWARE ) ) ) . stopOnError ( Boolean . parseBoolean ( System . getProperty ( VALIDATION_STOP_ON_ERROR ) ) ) . warningsFatal ( Boolean . parseBoolean ( System . getProperty ( VALIDATION_WARNINGS_FATAL ) ) ) . suppressOutput ( Boolean . parseBoolean ( System . getProperty ( VALIDATION_SUPPRESS_OUTPUT ) ) ) ; final Path path = Paths . get ( sbeSchemaFilename ) ; try ( InputStream in = new BufferedInputStream ( Files . newInputStream ( path ) ) ) { final InputSource inputSource = new InputSource ( in ) ; if ( path . toAbsolutePath ( ) . getParent ( ) != null ) { inputSource . setSystemId ( path . toUri ( ) . toString ( ) ) ; } XmlSchemaParser . validate ( xsdFilename , inputSource , optionsBuilder . build ( ) ) ; } }
Validate the SBE Schema against the XSD .