@Test public void Superscript() { FreetextConfig config = new FreetextConfig(true, false); String xml = "<p>metallic barium ion can lose 2 electrons to become Ba<sup>2+</sup></p>"; String expect = "\nmetallic barium ion can lose 2 electrons to become Ba^{2+}\n"; Document jsoupDoc = Jsoup.parse(xml, "", Parser.xmlParser()); HtmlToPlainText converter = new HtmlToPlainText(config); String plainText = converter.getPlainText(jsoupDoc); assertEquals(expect, plainText); }
public String getPlainText(Element element) { traverse(element); return this.toString(); }
HtmlToPlainText implements NodeVisitor { public String getPlainText(Element element) { traverse(element); return this.toString(); } }
HtmlToPlainText implements NodeVisitor { public String getPlainText(Element element) { traverse(element); return this.toString(); } HtmlToPlainText(FreetextConfig config); }
HtmlToPlainText implements NodeVisitor { public String getPlainText(Element element) { traverse(element); return this.toString(); } HtmlToPlainText(FreetextConfig config); String getPlainText(Element element); void traverse(Node root); boolean filter(Node node); boolean replace(Node node); void head(Node node, int depth); void tail(Node node, int depth); @Override String toString(); }
HtmlToPlainText implements NodeVisitor { public String getPlainText(Element element) { traverse(element); return this.toString(); } HtmlToPlainText(FreetextConfig config); String getPlainText(Element element); void traverse(Node root); boolean filter(Node node); boolean replace(Node node); void head(Node node, int depth); void tail(Node node, int depth); @Override String toString();  }