code: public ValidationResult validateInstance(Source s, SAXParserFactory factory) {
          if (factory == null) {
              throw new IllegalArgumentException("factory must not be null");
          }
          try {
              factory.setNamespaceAware(true);
              factory.setValidating(true);
              SAXParser parser = factory.newSAXParser();
              if (Languages.W3C_XML_SCHEMA_NS_URI.equals(language)) {
                  parser.setProperty(Properties.SCHEMA_LANGUAGE,
                                     Languages.W3C_XML_SCHEMA_NS_URI);
              }
              final Source[] source = getSchemaSources();
              Handler handler = new Handler();
              if (source.length != 0) {
                  if (Languages.W3C_XML_SCHEMA_NS_URI.equals(language)) {
                      InputSource[] schemaSource = new InputSource[source.length];
                      for (int i = 0; i < source.length; i++) {
                          schemaSource[i] = Convert.toInputSource(source[i]);
                      }
                      parser.setProperty(Properties.SCHEMA_SOURCE,
                                         schemaSource);
                  } else if (source.length == 1) {
                      handler.setSchemaSystemId(source[0].getSystemId());
                  }
              }
              InputSource input = Convert.toInputSource(s);
              try {
                  parser.parse(input, handler);
              } catch (SAXParseException e) {
                  handler.error((SAXParseException) e);
              } catch (SAXException e) {
                  throw new XMLUnitException(e);
              }
              return handler.getResult();
          } catch (ParserConfigurationException ex) {
              throw new ConfigurationException(ex);
          } catch (SAXNotRecognizedException ex) {
              throw new ConfigurationException(ex);
          } catch (SAXNotSupportedException ex) {
              throw new ConfigurationException(ex);
          } catch (SAXException ex) {
              throw new XMLUnitException(ex);
          } catch (java.io.IOException ex) {
              throw new XMLUnitException(ex);
          }
      }
docs: Validates an instance against the schema using a pre-configured {@link SAXParserFactory}.
  
  <p>The factory given will be configured to be namespace aware and validating.</p>
  
  @param s the instance document
  @param factory the factory to use, must not be null
  
  @since XMLUnit 2.6.0