A Comprehensive Guide to JSilver's Java Stream HTML Parser

<dependency> <groupId>com.java2novice</groupId> <artifactId>jsilver-htmlparser</artifactId> <version>1.0</version> </dependency> html <html> <body> <h1>Welcome to JSilver's Java Stream HTML Parser</h1> <ul> <li>Introduction</li> <li>Configuration</li> <li>Usage</li> <li>Conclusion</li> </ul> </body> </html> import com.java2novice.htmlparser.HtmlStreamHandler; import com.java2novice.htmlparser.streams.HtmlStreams; import javax.xml.stream.XMLStreamException; import java.io.InputStream; public class HTMLParserExample { public static void main(String[] args) throws XMLStreamException { InputStream inputStream = HTMLParserExample.class.getClassLoader().getResourceAsStream("example.html"); HtmlStreams.parseHtmlAsStream(inputStream) .offset(26) .whenE('h2', h2 -> System.out.println(h2.getText())) .whenE('li', li -> System.out.println(li.getText())); } } Welcome to JSilver's Java Stream HTML Parser Introduction Configuration Usage Conclusion


上一篇:
下一篇:
切换中文