code: private List<CmsClientSitemapEntry> getChildren(String root, int levels, String targetPath) {
  
          List<CmsClientSitemapEntry> children = new ArrayList<CmsClientSitemapEntry>();
          int i = 0;
          for (CmsJspNavElement navElement : getNavBuilder().getNavigationForFolder(
              root,
              Visibility.all,
              CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
              try {
                  CmsClientSitemapEntry child = toClientEntry(navElement, false);
                  if (child != null) {
                      child.setPosition(i);
                      children.add(child);
                      int nextLevels = levels;
                      if ((nextLevels == 2) && (targetPath != null) && targetPath.startsWith(child.getSitePath())) {
                          nextLevels = 3;
                      }
                      if (child.isFolderType() && ((nextLevels > 1) || (nextLevels == -1)) && !isSubSitemap(navElement)) {
  
                          child.setSubEntries(getChildren(child.getSitePath(), nextLevels - 1, targetPath), null);
                          child.setChildrenLoadedInitially(true);
                      }
                      i++;
                  }
              } catch (CmsException e) {
                  LOG.error("Could not read sitemap entry.", e);
              }
          }
          return children;
      }
docs: Returns the sitemap children for the given path with all descendants up to the given level or to the given target path, ie.
  <dl><dt>levels=1 <dd>only children<dt>levels=2<dd>children and great children</dl>
  and so on.<p>
  
  @param root the site relative root
  @param levels the levels to recurse
  @param targetPath the target path
  
  @return the sitemap children