question: public static boolean validateXML ( String dialSpecs , String schemaFile ) { log . fine ( "Checking the validation of file " + dialSpecs + " against XML schema " + schemaFile + "..." ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; try { SchemaFactory schema = SchemaFactory . newInstance ( "http://www.w3.org/2001/XMLSchema" ) ; factory . setSchema ( schema . newSchema ( new Source [ ] { new StreamSource ( schemaFile ) } ) ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; try { builder . setErrorHandler ( new XMLErrorHandler ( ) ) ; Document doc = builder . parse ( new InputSource ( dialSpecs ) ) ; log . fine ( "XML parsing of file: " + dialSpecs + " successful!" ) ; String rootpath = dialSpecs . substring ( 0 , dialSpecs . lastIndexOf ( "//" ) + 1 ) ; Vector < String > includedFiles = extractIncludedFiles ( doc ) ; for ( String file : includedFiles ) { boolean validation = validateXML ( rootpath + file , schemaFile ) ; if ( ! validation ) { return false ; } } } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) ) ; } return true ; } catch ( SAXException e ) { log . warning ( "Validation aborted: \n" + e . getMessage ( ) ) ; return false ; } catch ( ParserConfigurationException e ) { log . warning ( e . getMessage ( ) ) ; return false ; } }
target:  Validates a XML document containing a specification of a dialogue domain. Returns true if the XML document is valid, false otherwise.