Thanks Edwin. This really helps. I will take care of the default namespaces from here on.
The tbody ommission is even more funny. I am using firebug to extract XPaths from the document. It turns out firebug is adding the Tbody element to the xpath. Thanks for spotting it out for me. Thanks anand On 6/20/07, Edwin Dankert <[EMAIL PROTECTED]> wrote: > The problem is your default namespace, you will have to map this > namespace to a prefix and use the prefix in your xpath expressions > > HashMap map = new HashMap(); > map.put("html", "http://www.w3.org/1999/xhtml"); > > XPath xpath = doc.createXPath("/html:html/html:head/html:title"); > xpath.setNamespaceContext(new SimpleNamespaceContext(map)); > > System.out.println(xpath.evaluate(document)); > > There are no "tbody" elements in the document. Please try the following > instead: > > xpath = > doc.createXPath("/html:html/html:body/html:table/html:tr/html:td/html:table[2]/html:tr/html:td/html:table[2]//html:tr"); > xpath.setNamespaceContext(new SimpleNamespaceContext(map)); > > System.out.println(xpath.evaluate(document)); > > Regards, > Edwin > -- > http://www.edankert.com/ > -- Change is the only Constant http://jroller.com/page/araman http://del.icio.us/diduknow/wishlist ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user