void (Element element, StringBuilder sb) { for (Iterator<?> it = element.getContent().iterator(); it.hasNext(); ) { Content c = (Content)it.next(); if (c instanceof Element) { recurseElementText((Element)c, sb); } else if (c instanceof Text) { sb.append(((Text)c).getText()); } } }