Node content = session.getRootNode().addNode("test");
content.addNode("one").addNode("child").setProperty("prop", "hello");
content.addNode("two").addNode("child").setProperty("prop", "hi");
session.save();
String query = "//*[*/@prop = 'hello']";
QueryResult r = session.getWorkspace().getQueryManager().createQuery(
query, "xpath").execute();
NodeIterator it = r.getNodes();
assertTrue(it.hasNext());
String path = it.nextNode().getPath();
assertEquals("/test/one", path);
assertFalse(it.hasNext());
query = "//*[*/*/@prop = 'hello']";
r = session.getWorkspace().getQueryManager().createQuery(
query, "xpath").execute();
it = r.getNodes();
assertTrue(it.hasNext());
path = it.nextNode().getPath();
assertEquals("/test", path);
assertFalse(it.hasNext());