final Stack<Node> stack = new Stack<Node>(); // using heap stack, avoids deep recursive calls
if (e.getFirstChild() != null)
stack.push(e.getFirstChild());
while (!stack.isEmpty()) {
Node n = stack.pop();
n.visitBy(new NodeVisitor() {
@Override
public void visit(Text n) {
printEscaped(b, n.getString(), false);
if (n.getNextSibling() != null)
stack.push(n.getNextSibling());