Take a look at the XPathQuery interface, it even gives an example.
https://apidocs.rnd.mendix.com/10/runtime/com/mendix/datastorage/XPathQuery.html
List<IMendixObject> results = core.createXPathQuery("//Entity[attribute=$value]")
.setVariable("value", 1)
.setAmount(500)
.setOffset(50)
.setDepth(1)
.execute(context);
Hey,
To retrieve xpath in Java action you should follow Mendix Client documentation (be aware there are diferent client api based of your mendix version). Link is for Mendix version 10 but in your case you should search for Mendix version 9
https://apidocs.rnd.mendix.com/10/runtime/com/mendix/datastorage/XPathQuery.html