@Test public void validateWithNullSchemaListAndNoSchemaLocation() throws SAXException, IOException { Document doc = parseResourceDocument("/ipo.xml"); XmlErrorHandler errHandler = new XmlErrorHandler(); XMLValidatingParser iut = new XMLValidatingParser(); iut.validateAgainstXMLSchemaList(doc, Collections.emptyList(), errHandler); assertFalse("Expected one or more validation errors.", errHandler.isEmpty()); }
void validateAgainstXMLSchemaList(Document doc, List<SchemaSupplier> xsdList, ErrorHandler errHandler) throws SAXException, IOException { jlogger.fine("Validating XML resource from " + doc.getDocumentURI() + " with these specified schemas: " + xsdList); Schema schema; if (!xsdList.isEmpty()) { schema = schemaLoader.loadSchema(ImmutableList.copyOf(xsdList)); } else { schema = schemaLoader.defaultSchema(); } Validator validator = schema.newValidator(); validator.setErrorHandler(errHandler); DOMSource source = new DOMSource(doc, doc.getBaseURI()); validator.validate(source); }
XMLValidatingParser { void validateAgainstXMLSchemaList(Document doc, List<SchemaSupplier> xsdList, ErrorHandler errHandler) throws SAXException, IOException { jlogger.fine("Validating XML resource from " + doc.getDocumentURI() + " with these specified schemas: " + xsdList); Schema schema; if (!xsdList.isEmpty()) { schema = schemaLoader.loadSchema(ImmutableList.copyOf(xsdList)); } else { schema = schemaLoader.defaultSchema(); } Validator validator = schema.newValidator(); validator.setErrorHandler(errHandler); DOMSource source = new DOMSource(doc, doc.getBaseURI()); validator.validate(source); } }
XMLValidatingParser { void validateAgainstXMLSchemaList(Document doc, List<SchemaSupplier> xsdList, ErrorHandler errHandler) throws SAXException, IOException { jlogger.fine("Validating XML resource from " + doc.getDocumentURI() + " with these specified schemas: " + xsdList); Schema schema; if (!xsdList.isEmpty()) { schema = schemaLoader.loadSchema(ImmutableList.copyOf(xsdList)); } else { schema = schemaLoader.defaultSchema(); } Validator validator = schema.newValidator(); validator.setErrorHandler(errHandler); DOMSource source = new DOMSource(doc, doc.getBaseURI()); validator.validate(source); } XMLValidatingParser();  XMLValidatingParser(Document schema_links); }
XMLValidatingParser { void validateAgainstXMLSchemaList(Document doc, List<SchemaSupplier> xsdList, ErrorHandler errHandler) throws SAXException, IOException { jlogger.fine("Validating XML resource from " + doc.getDocumentURI() + " with these specified schemas: " + xsdList); Schema schema; if (!xsdList.isEmpty()) { schema = schemaLoader.loadSchema(ImmutableList.copyOf(xsdList)); } else { schema = schemaLoader.defaultSchema(); } Validator validator = schema.newValidator(); validator.setErrorHandler(errHandler); DOMSource source = new DOMSource(doc, doc.getBaseURI()); validator.validate(source); } XMLValidatingParser();  XMLValidatingParser(Document schema_links); Document parse(URLConnection uc, Element instruction,
			PrintWriter logger); boolean checkXMLRules(Document doc, Document instruction); NodeList validate(Document doc, Document instruction); Element validateSingleResult(Document doc, Document instruction); }
XMLValidatingParser { void validateAgainstXMLSchemaList(Document doc, List<SchemaSupplier> xsdList, ErrorHandler errHandler) throws SAXException, IOException { jlogger.fine("Validating XML resource from " + doc.getDocumentURI() + " with these specified schemas: " + xsdList); Schema schema; if (!xsdList.isEmpty()) { schema = schemaLoader.loadSchema(ImmutableList.copyOf(xsdList)); } else { schema = schemaLoader.defaultSchema(); } Validator validator = schema.newValidator(); validator.setErrorHandler(errHandler); DOMSource source = new DOMSource(doc, doc.getBaseURI()); validator.validate(source); } XMLValidatingParser();  XMLValidatingParser(Document schema_links); Document parse(URLConnection uc, Element instruction,
			PrintWriter logger); boolean checkXMLRules(Document doc, Document instruction); NodeList validate(Document doc, Document instruction); Element validateSingleResult(Document doc, Document instruction);  }