Code example for Validator

Methods: setErrorHandler, validate

0
 
 
            Validator validator = schema.newValidator();
 
            NewStackTraceErrorHandler errHandler = new NewStackTraceErrorHandler();
            validator.setErrorHandler(errHandler);
            SAXSource saxSource = new SAXSource(saxParser.getXMLReader(), wsdlsource);
            validator.validate(saxSource);
 
 
            if (!errHandler.isValid()) {
                throw new ToolException(errHandler.getErrorMessages());
            } 
 
            isValid = true;
 
        } catch (IOException ioe) {
            throw new ToolException("Cannot get the wsdl " + wsdlsource.getSystemId(), ioe);
        } catch (SAXException saxEx) {
            throw new ToolException(saxEx);
        } catch (ParserConfigurationException e) {