Get All Child Nodes | Community
Skip to main content
Level 2
Oct 16, 2015 2:26 AM UTC
Solved

Get All Child Nodes

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.
Sham_HC
Sham_HCAccepted solution
Level 10
Oct 16, 2015 2:26 AM UTC

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
Feb 21, 2022 8:28 AM UTC
Level 3
Oct 16, 2015 2:26 AM UTC

Please view the sitemap component in libs/foundation

Translate
Feike_Visser1
Employee
Oct 16, 2015 2:26 AM UTC

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.

Translate
chansriniAuthor
Level 2
Oct 16, 2015 2:26 AM UTC

Hi All,

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

Thanks,

Srinivasan.

Translate
Sham_HC
Sham_HCAccepted solution
Level 10
Oct 16, 2015 2:26 AM UTC

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

Translate