You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Hugo Duncan <hu...@yahoo.com> on 2006/09/21 02:39:00 UTC

XPath namespace prefixes

I had a look through the archives and couldn't see any discussion on this,  
so apologies if I missed it.  At some point since 0.1.0 the XPath  
setDefaultNamespaces(Map<String,String> namespaces) method was removed,  
and I don't see any way of constructing an XPath instance with an  
additional namespace prefix (except by subclassing FOMXPath).  Is there  
some way of adding a namespace prefix that I have missed, or a rationale  
for not being able to do so?

Hugo


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: XPath namespace prefixes

Posted by James M Snell <ja...@gmail.com>.
This should work

  Map<String,String> ns = xpath.getDefaultNamespaces();
  ns.put("f","urn:foo");
  String s = xpath.valueOf("...", element, ns);

- james


Hugo Duncan wrote:
> I had a look through the archives and couldn't see any discussion on this,  
> so apologies if I missed it.  At some point since 0.1.0 the XPath  
> setDefaultNamespaces(Map<String,String> namespaces) method was removed,  
> and I don't see any way of constructing an XPath instance with an  
> additional namespace prefix (except by subclassing FOMXPath).  Is there  
> some way of adding a namespace prefix that I have missed, or a rationale  
> for not being able to do so?
> 
> Hugo
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>