@sateeshreddy You could use sling APIs to do so-
Take a root path
loop the resource and nodes as per your requirement via listchildren, Iterators,hasNode() etc until the leaf node.
use value map object - eg: currentResource.getValueMap()
compare the slingResourceType and read your values.
You coul...