I am trying to use the javax.xml.xpath package to run XPath expressions on a document with multiple namespaces, and I\'m having goofy performance problems.
My test d
This is a little bit late, but I ran into the same situation, but it seemed like my document was so big that none of the other answers really resolved the problem.
Eventually, I found jaxen. Once I used it, the document which previously took 15 seconds to parse took mere milliseconds.
Jaxen is unfortunately rather badly documented, but worked quite well:
DOMXPath myXPath = new DOMXPath("atom:id/text()");
String myContent = myXPath.stringValueOf(myDocument);
The Java Doc can be found here http://jaxen.codehaus.org/apidocs/org/jaxen/dom/DOMXPath.html