import com.ops4j.pax.carrot.parser.CarrotParser;
import com.ops4j.pax.carrot.parser.CarrotParserFactory;
public class HTMLParserExample {
public static void main(String[] args) throws Exception {
CarrotParser carrotParser = CarrotParserFactory.newInstance().newCarrotParser();
String html = "<html><body><h1>Hello, World!</h1></body></html>";
carrotParser.parse(html);
String result = carrotParser.query("h1").content();
}
}
<dependency>
<groupId>com.ops4j.pax.carrot</groupId>
<artifactId>pax-carrot-html</artifactId>
<version>1.0.0</version>
</dependency>