### Question:
XMLValidatingParser { public NodeList validate(Document doc, Document instruction) throws Exception { return schemaValidation(doc, instruction).toNodeList(); } 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);  }### Answer:
@Test public void validateWithNullDTDList_valid() throws Exception { final Document doc = parseResourceDocument("/testng.xml"); XMLValidatingParser iut = new XMLValidatingParser(); NodeList errList = iut.validate(doc, null); assertEquals("Unexpected number of validation errors reported.", 0, errList.getLength()); }
@Test public void validateWithMismatchedDTDList() throws Exception { final Document doc = parseResourceDocument("/testng.xml"); final Document dtdInstructions = parseResourceDocument("/conf/dtd-ref-wms.xml"); XMLValidatingParser iut = new XMLValidatingParser(); NodeList errList = iut.validate(doc, dtdInstructions); assertTrue("should report validation errors", errList.getLength() > 0); }
@Test public void validateDocumentWithDoctype_invalid() throws Exception { final Document doc = parseResourceDocument("/testng-invalid.xml"); XMLValidatingParser iut = new XMLValidatingParser(); NodeList errList = iut.validate(doc, null); assertEquals("Unexpected number of validation errors reported.", 2, errList.getLength()); }