[jdom-interest] xpath + namespace + no prefix

David Harrigan dharrigan at gmail.com
Wed Nov 15 05:54:09 PST 2006


Hi,

I'm having a bit of a problem. I'm receiving an XML document with the
following example stucture:


  
    <C>1234</C>
  


If I try this:

XPath xPath = XPath.newInstance("//C");
List<Element> elements = xPath.selectNodes(document);

I get back no elements

If I try this:

XPath xPath = XPath.newInstance("//C");
xPath.addNamespace("", "http://www.somewhere.com");
List<Element> elements = xPath.selectNodes(document);

I get back no elements

I believe the inclusions of the namespace is throwing xPath off (because
the element has no prefix?)

Any help on this would be appreciated.

Thanks

-=david=-
-- 
View this message in context: http://www.nabble.com/xpath-%2B-namespace-%2B-no-prefix-tf2636213.html#a7357968
Sent from the JDOM - General mailing list archive at Nabble.com.



More information about the jdom-interest mailing list