TextCatVisitor v = new TextCatVisitor(compiler); page.visit(v); // Cleanup, in case the page ends with a template text v.collectText();