XMLAssert.assertXpathEvaluatesTo(Gateway.class.getName(), "/hibernate-mapping/subclass/@extends", xml); XMLAssert.assertXpathEvaluatesTo(MediantGateway.class.getName(), "/hibernate-mapping/subclass/@name", xml); XMLAssert.assertXpathEvaluatesTo("gwMediant1000", "/hibernate-mapping/subclass/@discriminator-value", xml);
SAXReader xmlReader = new SAXReader(); xmlReader.setEntityResolver(new DTDEntityResolver()); xmlReader.setValidation(true);  Document document = xmlReader.read(new StringReader(xml));  assertEquals(Gateway.class.getName(), document.valueOf("/hibernate-mapping/subclass/@extends")); assertEquals(MediantGateway.class.getName(), document.valueOf("/hibernate-mapping/subclass/@name")); assertEquals("gwMediant1000", document.valueOf("/hibernate-mapping/subclass/@discriminator-value"));
    private static void validateXml(String xml) throws Exception {        XMLAssert.assertXpathEvaluatesTo(Gateway.class.getName(), "/hibernate-mapping/subclass/@extends",                xml);        XMLAssert.assertXpathEvaluatesTo(MediantGateway.class.getName(),                "/hibernate-mapping/subclass/@name", xml);        XMLAssert.assertXpathEvaluatesTo("gwMediant1000",                "/hibernate-mapping/subclass/@discriminator-value", xml);            }