Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Element versus Document with XPath

Mark Hale

2005-11-08

Replies:

I was wondering if any of you have ever experienced the same problems.
If I do an :

 Element result = (Element) XPath.selectSingleNode(el, "some
path");

I get result=null. However, if I do:

 Document doc = new Document ((Element) el.clone(), new
DocType("xml"));
 Element result = (Element) XPath.selectSingleNode(doc, "some
path");

I get the right answer for result.

Why is it that Xpath doesn't work on the element but does on the
document?

Thanks - I am stumped and see this behaviour quite often.

 Mark


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.