private void validate() {
        if (isValid != null) {
            return;
        }

        ParsingValidator v =
            new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI
                                 : Languages.XML_DTD_NS_URI);
        List<Source> schemaSourceList = new ArrayList<Source>();
        if (systemId != null) {
            schemaSourceList.add(new StreamSource(systemId));
        }
        addSchemaSources(schemaSource, schemaSourceList);
        v.setSchemaSources(schemaSourceList.toArray(new Source[0]));

        try {
            ValidationResult r =
                v.validateInstance(new SAXSource(validationInputSource));
            isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE;
            for (ValidationProblem p : r.getProblems()) {
                validationProblem(p);
            }
        } catch (org.xmlunit.ConfigurationException e) {
            throw new ConfigurationException(e.getCause());
        } catch (org.xmlunit.XMLUnitException e) {
            throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
        }

        if (usingDoctypeReader && isValid == Boolean.FALSE) {
            try {
                messages.append("\nContent was: ")
                    .append(getOriginalContent(validationInputSource));
            } catch (IOException e) {
                // silent but deadly?
            }
        }
    }
private void validate ( ) { if ( isValid != null ) { return ; } ParsingValidator v = new ParsingValidator ( useSchema ? Languages . W3C_XML_SCHEMA_NS_URI : Languages . XML_DTD_NS_URI ) ; List < Source > schemaSourceList = new ArrayList < Source > ( ) ; if ( systemId != null ) { schemaSourceList . add ( new StreamSource ( systemId ) ) ; } addSchemaSources ( schemaSource , schemaSourceList ) ; v . setSchemaSources ( schemaSourceList . toArray ( new Source [ 0 ] ) ) ; try { ValidationResult r = v . validateInstance ( new SAXSource ( validationInputSource ) ) ; isValid = r . isValid ( ) ? Boolean . TRUE : Boolean . FALSE ; for ( ValidationProblem p : r . getProblems ( ) ) { validationProblem ( p ) ; } } catch ( org . xmlunit . ConfigurationException e ) { throw new ConfigurationException ( e . getCause ( ) ) ; } catch ( org . xmlunit . XMLUnitException e ) { throw new XMLUnitRuntimeException ( e . getMessage ( ) , e . getCause ( ) ) ; } if ( usingDoctypeReader && isValid == Boolean . FALSE ) { try { messages . append ( "\nContent was: " ) . append ( getOriginalContent ( validationInputSource ) ) ; } catch ( IOException e ) { } } }
Actually perform validation.