public boolean checkSchematronRules ( Document doc , String schemaFile , String phase ) throws Exception { boolean isValid = false ; if ( doc == null || doc . getDocumentElement ( ) == null ) return isValid ; try { ClassLoader loader = this . getClass ( ) . getClassLoader ( ) ; URL url = loader . getResource ( schemaFile ) ; this . schemaFile = new File ( URLDecoder . decode ( url . getFile ( ) , "UTF-8" ) ) ; } catch ( Exception e ) { assert false : "Entity body not found. " + e . toString ( ) ; } this . phase = phase ; Document returnDoc = parse ( doc , null , null ) ; if ( returnDoc != null ) { isValid = true ; } return isValid ; }
Checks the given schematron phase for the XML file and returns the validation status .