private List < DataSchema > parseSchema ( final File schemaSourceFile , CourierParseResult result ) throws IOException { SchemaParser parser = _schemaParserFactory . create ( _schemaResolver ) ; final FileInputStream schemaStream = new SchemaFileInputStream ( schemaSourceFile ) ; try { parser . setLocation ( new FileDataSchemaLocation ( schemaSourceFile ) ) ; parser . parse ( schemaStream ) ; if ( parser . hasError ( ) ) { return Collections . emptyList ( ) ; } return parser . topLevelDataSchemas ( ) ; } finally { schemaStream . close ( ) ; if ( parser . hasError ( ) ) { result . addMessage ( schemaSourceFile . getPath ( ) + "," ) ; result . addMessage ( parser . errorMessage ( ) ) ; } } }
Parse a source file to obtain the data schemas contained within .