Thank you Evan, Mark and Edwin!
Edwin's solution worked straight up... hooray. I actually thought of that but was sure it wouldn't work because I
thought all my elements in my document would need to be prefixed as well. Now I see that the prefix is just preventing
the XPath processor from ignor
You should specify a prefix for your namespace and use this prefix
in your XPath expression.
The following should work:
Document document = reader.read(new File("findings.html"));
XPath xp = DocumentFactory.getInstance().createXPath(
"//xhtml:[EMAIL PROTECTED]'content_left']");
Map ns = new HashM
EMAIL PROTECTED]
Sent: Friday, February 24, 2006 2:58 PM
To: dom4j-user@lists.sourceforge.net
Subject: [dom4j-user] xpath annoyances
I'm having trouble with xpath's returning valid results in dom4j. My
co-worker was trying to select a div in an xhtml
file based on a class attributes and
I'm having trouble with xpath's returning valid results in dom4j. My co-worker was trying to select a div in an xhtml
file based on a class attributes and was getting any results, even though he could get results with the same XPath in
jedit (using saxon) and it worked fine.
I told him about th