IM going nuts trying to use DOM4J to query something so simple. Here is the input XML file and the code to run the XPath. If I loop through the document using the annoying element and node map thing it works fine and I can get all the nodes. But I want to run an XPath query right to the information I want. Firs time I tried without the URI nodes and this time I tried it with it. Still no luck.
XML FILE
<?xml version="1.0"?>
<configs>
<config SERVICE="Service Name">
<detail name="key">value</detail>
</config>
<config SERVICE="ProcessErrors">
<detail name="ErrorEmailAddresses">johnsmith@hotmail.com</detail>
</config>
<config SERVICE="TestSQLErrors">
<detail name="ErrorEmailAddresses">johnsmith@hotmail.com</detail>
</config>
</configs>
CODE
File fXmlFile = new File("n:\\config.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();
XPath xpathNodes = new DefaultXPath("//configs/config[@SERVICE='ProcessErrors']/detail[@name='ErrorEmailAddresses']");
HashMap<String, String> mapNodes = new HashMap<String,String>();
xpathNodes.setNamespaceURIs(mapNodes);
Node exceptionNode = (Node)xpathNodes.selectSingleNode(doc);
System.out.println(exceptionNode);
exceptionNode is empty. If I run this same query on the same document in XML spy I get the value.???