public void testXPaths() throws Exception {
Document document = getDocument("/xml/rabo1ae.xml");
Element root = (Element) document
.selectSingleNode("/m:Msg/m:Contents/m:Content");
assertTrue("root is not null", root != null);
Namespace ns = root.getNamespaceForPrefix("ab");
assertTrue("Found namespace", ns != null);
System.out.println("Found: " + ns.getURI());
Element element = (Element) root
.selectSingleNode("ab:RaboPayLoad[@id='1234123']");
assertTrue("element is not null", element != null);
String value = element.valueOf("ab:AccountingEntry/ab:RateType");
assertEquals("RateType is correct", "CRRNT", value);
}
|