[jdom-interest] xpath + namespace + no prefix
    David Harrigan 
    dharrigan at gmail.com
       
    Wed Nov 15 05:56:31 PST 2006
    
    
  
Bah,
For those reading this on the web:
<A xmlns="http://www.somewhere.com">
  <B>
    <C>1234</C>
  </B>
</A>
-=david=-
David Harrigan wrote:
> 
> 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#a7358005
Sent from the JDOM - General mailing list archive at Nabble.com.
    
    
More information about the jdom-interest
mailing list