Search in sources :

Example 6 with NodeTraversor

use of org.jsoup.select.NodeTraversor in project AntennaPod by AntennaPod.

the class HtmlToPlainText method getPlainText.

/**
     * Format an Element to plain-text
     * @param element the root element to format
     * @return formatted text
     */
public String getPlainText(Element element) {
    FormattingVisitor formatter = new FormattingVisitor();
    NodeTraversor traversor = new NodeTraversor(formatter);
    // walk the DOM, and call .head() and .tail() for each node
    traversor.traverse(element);
    return formatter.toString();
}
Also used : NodeTraversor(org.jsoup.select.NodeTraversor)

Example 7 with NodeTraversor

use of org.jsoup.select.NodeTraversor in project eclipse.jdt.ls by eclipse.

the class HtmlToPlainText method getPlainText.

/**
 * Format an Element to plain-text
 * @param element the root element to format
 * @return formatted text
 */
public String getPlainText(Element element) {
    FormattingVisitor formatter = new FormattingVisitor();
    NodeTraversor traversor = new NodeTraversor(formatter);
    // walk the DOM, and call .head() and .tail() for each node
    traversor.traverse(element);
    return formatter.toString();
}
Also used : NodeTraversor(org.jsoup.select.NodeTraversor)

Aggregations

NodeTraversor (org.jsoup.select.NodeTraversor)7 TemplateNode (com.vaadin.flow.template.angular.TemplateNode)1 ArrayList (java.util.ArrayList)1 Node (org.jsoup.nodes.Node)1 TextNode (org.jsoup.nodes.TextNode)1 NodeVisitor (org.jsoup.select.NodeVisitor)1