code: public void appendChildren(Iterable<? extends NodeInfo> children) {
          Level current = path.getLast();
          int comments, pis, texts;
          comments = pis = texts = 0;
          Map<String, Integer> elements = new HashMap<String, Integer>();
  
          for (Level l : current.children) {
              String childName = l.expression;
              if (childName.startsWith(COMMENT)) {
                  comments++;
              } else if (childName.startsWith(PI)) {
                  pis++;
              } else if (childName.startsWith(TEXT)) {
                  texts++;
              } else {
                  childName = childName.substring(0, childName.indexOf(OPEN));
                  add1OrIncrement(childName, elements);
              }
          }
  
          for (NodeInfo child : children) {
              Level l;
              switch (child.getType()) {
              case Node.COMMENT_NODE:
                  l = new Level(COMMENT + OPEN + (++comments) + CLOSE);
                  break;
              case Node.PROCESSING_INSTRUCTION_NODE:
                  l = new Level(PI + OPEN + (++pis) + CLOSE);
                  break;
              case Node.CDATA_SECTION_NODE:
              case Node.TEXT_NODE:
                  l = new Level(TEXT + OPEN + (++texts) + CLOSE);
                  break;
              case Node.ELEMENT_NODE:
                  String name = getName(child.getName());
                  l = new Level(name + OPEN + add1OrIncrement(name, elements)
                                + CLOSE);
                  break;
              default:
                  // more or less ignore
                  // FIXME: is this a good thing?
                  l = new Level(EMPTY);
                  break;
              }
              current.children.add(l);
          }
      }
docs: Adds knowledge about the current node's children appending to
  the knowledge already present.