You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Omid Milani <om...@gmail.com> on 2009/12/03 09:23:01 UTC

xpath function for namespace-uri?

hi,

I'm trying to query (xpath) nodes of a specific namespace uri, but it
seems namespace-uri() and namespace-prefix() are not supported.
wlidcarding the local name part ( //prefix:* ) doesn't work either.
so, how can I do this?

also i notices an strange behavior. executing a query like this
doesn't throw exception, just no result:
//*[wrong-function-name() = 'nothing']
but executing this one results in InvalidQueryException:
//*[wrong-function-name()]
imo using mistaken function name should always result in exception.

Re: xpath function for namespace-uri?

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,

2009/12/3 Omid Milani <om...@gmail.com>:
> I'm trying to query (xpath) nodes of a specific namespace uri, but it
> seems namespace-uri() and namespace-prefix() are not supported.
> wlidcarding the local name part ( //prefix:* ) doesn't work either.
> so, how can I do this?

that's not possible with current XPath support in Jackrabbit. Using a
beta version of Jackrabbit 2.0 you can do this in JQOM:

        Query q = qf.createQuery(
                qf.selector("nt:base", "s"),
                qf.comparison(
                        qf.nodeName("s"),
                        QueryObjectModelConstants.JCR_OPERATOR_LIKE,
                        qf.literal(vf.createValue("prefix:%"))
                ),
                null,
                null
        );

regards
 marcel