oops, sorry, my fault. I didn't read through the full email. long
stacktraces always confuse me and make me think that the interesting
part is over ;)
you are on the right track, but you *only* need to encode the name
tests, that is the name '1' and '2', not the full path.
what you should get in the end is a query like the following:
/jcr:root/_x0031_/_x0032_//element(*, nt:resource)[jcr:contains(.,'aaa')]
regards
marcel
Giota Karadimitriou wrote:
Thank you, like I said at the end of my email I already used the ISO9075
class, so it is nice to receive verification I'm on the right track
here;
however, when I used it to encode '/1/2' my program returns me 0 results
while it should have returned 1 (which is what happens when I run the
query without '/1/2' in front).
String pattern="/1/2";
String patternNew=ISO9075.encode(pattern);
System.out.println(patternNew);
Query q =
qm.createQuery(patternNew+"//element(*,nt:resource)[jcr:contains(.,'aaaa
a')]", Query.XPATH);
QueryResult result = q.execute();
NodeIterator it = result.getNodes();
System.out.println("IT:"+it.getSize());
while (it.hasNext()) {
Node n = it.nextNode();
System.out.println("name:" + n.getName());
System.out.println("path:" + n.getPath());
}
_x002f_1_x002f_2
IT:0