public List<Element> collectChildren(int level, Node node) {
   Collector<Element> collector = new Collector<Element>();
   iTextContext().pushElementConsumer(collector);
   for (Node child : node.getChildren()) {
     process(level + 1, child);
   }
   iTextContext().popElementConsumer();
   return collector.getCollected();
 }
  public void process(int depth, Node node) {
    if (depth == 0) {
      references.traverse(node);
    }

    Processor processor = processors().get(node.getClass());
    if (processor == null) {
      log.warn("No processor defined for type {}", node.getClass());
      processor = processorDefault;
    }

    treeNavigation.push(node);

    dumpProcessor(depth, node, processor);
    processor.process(depth, node, this);

    treeNavigation.pop();
  }
 public void processChildren(int level, Node node) {
   for (Node child : node.getChildren()) {
     process(level + 1, child);
   }
 }