Get All Child Nodes | Community
Skip to main content
New Participant
October 16, 2015
Solved

Get All Child Nodes

  • October 16, 2015
  • 5 replies
  • 8325 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

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

5 replies

Employee
February 21, 2022
New Participant
October 16, 2015

Please view the sitemap component in libs/foundation

Feike_Visser1
Employee
October 16, 2015

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.commons.Filter, boolean)

Via the boolean parameter you can get all the levels.

chansriniAuthor
New Participant
October 16, 2015

Hi All,

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

Thanks,

Srinivasan.

Sham_HC
Sham_HCAccepted solution
New Participant
October 16, 2015

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