Java Mailing List Archive

Home » JDOM Projects »

[jdom-interest] Tagsoup, JDOM, Xpath

Frank Cohen


Author LoginPost Reply
Hi JDOMistas!

I am having a problem using the XPather add-on to Firefox with JDOM
and Tagsoup and hope one of you may be able to help me.

I point Firefox at
file=file2.html and use XPather to generate an XPath expression to
point to the Type selection list in the second form. XPather gives me:

I then try to apply the XPath expression using JDOM and Tagsoup:

builder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser")
doc = StringReader( html from http:// ) )
xpathr = JDOMXPath( xpathexpr )
results = xpathr.selectNodes( doc )

and results returns no nodes.

I found that Tagsoup adds its own default namespace of 'h' with a
value of ''. An Xpath expression of '/
h:html/h:body/h:form[2]' returns the second form correctly.

I suspect this is some Tagsoup weirdness.

Anyone have an idea on why the full XPath expression to the select
form element returns no nodes?


Frank Cohen,, phone 408 871 0122
PushToTest, the open-source test automation company

To control your jdom-interest membership:
©2008 - Jax Systems, LLC, U.S.A.