Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

How to get direct child nodes whose names starting with a keyword

Avatar

Level 2

I need to get direct child nodes whose name starts with a certain keyword. Below is the snippet of what I am trying but I am failing at retrieving the list :

 

NodeIterator childNodes = nodeObject.getNodes("topic*");

System.out.println("Has Next?"+childNodes.hasNext());

 

I get a false value for the second statement. I am trying to use pattern matching to retrieve nodes whose names start with "topic" [http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html#getNodes(java.lang.String)] . I can see that there are actually 2 child nodes for the nodeObject but the iterator is not returning any nodes. Could someone point out where I am going wrong? (I am not sure if the pattern I am using is correct)

0 Replies