protected void testXPath(String xpath) {
List list = document.selectNodes(xpath);
for (Iterator iter = list.iterator(); iter.hasNext();) {
Object object = iter.next();
log("Found Result: " + object);
assertTrue("Results not Text objects", object instanceof Text);
Text text = (Text) object;
assertTrue("Results should support the parent relationship", text
.supportsParent());
assertTrue(
"Results should contain reference to the parent element",
text.getParent() != null);
assertTrue("Results should not reference to the owning document",
text.getDocument() != null);
}
}
|