Using XPATH with DOM returned by getDOM()
"Milind W" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
hi, I am a newbie to httpunit. I would like to extract different pieces of data from a html page. The elements I want to extract data from are not necessarily tables or elements that have ids so that makes it hard to get to them using the standard webresponse methods. However I can get to the elements by traversing the dom (returned by getDOM) using the DOM methods. I would prefer to use XPATH instead of traversing the DOM as this meets my requirements perfectly. I tried using xpath with different libraries e.g dom4j as described in the following post http://sourceforge.net/mailarchive/message.php?msg_id=08077D82-1680-11D9-B9CB-000502F60B20%40httpunit.org which did not work for me. As the author of the post notes "I'm fine using a patched version internally so 'response.getDOM()' doesn't fail, so that's not a problem.". I am assuming he has internal version of httpunit and has modified the getDOM method. I also tried using jaxen but result always comes back empty. I have validated my xpath is correct using xpath explorer on my document. Can any one provide me any help in being able to extract data using XPath from the DOM returned by httpunit. I am also open to using XQuery but looks like the issue at is getting a DOM that can be used by XPATH or XQUERY. If anyone has any sample code that shows how to use XPATH with httpunit dom, I would greatly appreciate the help. If it needs modifications to the source to get it to work, please provide those as well. Not something I am looking forward to, but am prepared to roll up sleeves just in case. I am using version httpunit-1.6.2. Thanks -Milind ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/