AnsweredAssumed Answered

Namespace prefix problem in Xpath query using api

Question asked by sureshs on Jun 12, 2009
Latest reply on Apr 27, 2011 by merelv
Hi,

I have a space named RedArea inside company_home, my requirement is to retrieve the meta data/properties namely tags of all the documents(inserted at the time of upload) of that particular space,

When i used the following query in Node Browser of Alfresco, it gave me correct result. 

//cm:RedArea//@test:tags

but when i try to use the same in the following api, inside amps

List<Serializable> result = searchService.selectProperties(rootNodeRef, "//cm:RedArea//@test:tags", null, namespacePrefixResolver, false);
iam getting the following exception….

org.jaxen.UnresolvableException: XPath expression uses unbound namespace prefix cm org.jaxen.expr.DefaultNameStep.evaluate(DefaultNameStep.java:236) org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:154) org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:121) org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:112) org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:688) org.jaxen.BaseXPath.selectNodes(BaseXPath.java:227) org.alfresco.repo.search.NodeServiceXPath.selectNodes(NodeServiceXPath.java:195) org.alfresco.repo.search.impl.NodeSearcher.selectProperties(NodeSearcher.java:255) org.alfresco.repo.search.impl.lucene.ADMLuceneSearcherImpl.selectProperties(ADMLuceneSearcherImpl.java:662) org.alfresco.repo.search.SearcherComponent.selectProperties(SearcherComponent.java:114) org.alfresco.repo.search.AbstractSearcherComponent.selectProperties(AbstractSearcherComponent.java:85) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke


Can anyone please help me to solve the above issue…

Thanks in prior

Regards
Suresh.S

Outcomes