public void testSelectSingleNode() throws Exception {
Document document = getDocument("/xml/test/jimBrain.xml");
Node node = document.selectSingleNode("/properties/client/threadsafe");
assertTrue("Found a valid node", node != null);
Element server = (Element) document
.selectSingleNode("/properties/server");
assertTrue("Found a valid server", server != null);
Element root = document.getRootElement();
server = (Element) root.selectSingleNode("/properties/server");
assertTrue("Found a valid server", server != null);
// try finding it via a relative path
server = (Element) document.selectSingleNode("properties/server");
assertTrue("Found a valid server", server != null);
// now lets use a relative path
Element connection = (Element) server.selectSingleNode("db/connection");
assertTrue("Found a valid connection", connection != null);
}
|