Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Get All Child Nodes

Avatar

Level 2

Hi,

How to get all child nodes under root node(Myapp)?

Myapp
  - node1 - node1.1 , node1.2
  - node2

node1 is child node of root node and node1.1, node1.2 are child node of node1.

Kindly any one help me to get Node1, Node1.1, Node1.2 and node2

Thanks,
C.Srinivasan

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi C.Srinivasan,

    Adopt to node and use getNodes. Become familiar with jcr api to meet your need. 

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html#getNodes()

Thanks,
Sham

View solution in original post

5 Replies

Avatar

Level 3

Please view the sitemap component in libs/foundation

Avatar

Employee

In case these are pages, you can use the following method:

http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/api/Page.html#listChildren(com.day.cq.c..., boolean)

Via the boolean parameter you can get all the levels.

Avatar

Level 2

Hi All,

Thank you very much for your help, I have used query builder and its working fine.

Thanks,

Srinivasan.

Avatar

Correct answer by
Level 10

Hi C.Srinivasan,

    Adopt to node and use getNodes. Become familiar with jcr api to meet your need. 

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html#getNodes()

Thanks,
Sham