Search in sources :

Example 1 with ContentNode

use of org.htmlcleaner.ContentNode in project FastHub by k0shk0sh.

the class PreTagHandler method getPlainText.

private void getPlainText(StringBuffer buffer, Object node) {
    if (node instanceof ContentNode) {
        ContentNode contentNode = (ContentNode) node;
        String text = contentNode.getContent().toString();
        buffer.append(text);
    } else if (node instanceof TagNode) {
        TagNode tagNode = (TagNode) node;
        for (Object child : tagNode.getChildren()) {
            this.getPlainText(buffer, child);
        }
    }
}
Also used : ContentNode(org.htmlcleaner.ContentNode) TagNode(org.htmlcleaner.TagNode)

Aggregations

ContentNode (org.htmlcleaner.ContentNode)1 TagNode (org.htmlcleaner.TagNode)1