### Question:
XsdDOMValidator extends XsdValidator { public void validate() throws SAXException, IOException { validate(new DOMSource(document)); } XsdDOMValidator(Document document); URI getDefaultNamespace(); List<URI> getNamespaces(); void validate(); static String getDefaultNamespace(Element element);  }### Answer:
@Test public void test_validation_validdoc() throws IOException, SAXException, ParserConfigurationException { Document document = XmlUtil.parseStream(getClass().getResourceAsStream("xsdDomValidator-test-01.xml")); XsdDOMValidator validator = new XsdDOMValidator(document); validator.validate(); }
@Test public void test_validation_invaliddoc() throws IOException, SAXException, ParserConfigurationException { Document document = XmlUtil.parseStream(getClass().getResourceAsStream("xsdDomValidator-test-02.xml")); XsdDOMValidator validator = new XsdDOMValidator(document); try { validator.validate(); fail("Expected SAXParseException"); } catch(SAXParseException e) { assertEquals("cvc-complex-type.4: Attribute 'myName' must appear on element 'a:myNVP'.", e.getMessage()); } }