cancel
Showing results for 
Search instead for 
Did you mean: 

How to get NodeRef from XPath in Java?

mbel
Star Contributor
Star Contributor

Hello,

I have the following XPath as String which was previously converted as:

String xpath= this.nodeService.getPath(nodeRef).toPrefixString(namespaceService);

xpath is = > /app:company_home/st:sites/cm:test-site/cm:documentLibrary/cm:test.pdf

How I can convert the above Xpath to NodeRef?

Thank you in advance.

1 ACCEPTED ANSWER

mrks_js1
Star Contributor
Star Contributor

Afaik there is no method that does this kind of 'conversion' -> My best guess is to use the xpath in a searchService query similar to what was posted here: SearchService.selectNodes(...) example  

View answer in original post

1 REPLY 1

mrks_js1
Star Contributor
Star Contributor

Afaik there is no method that does this kind of 'conversion' -> My best guess is to use the xpath in a searchService query similar to what was posted here: SearchService.selectNodes(...) example