<dependency>
<groupId>org.ops4j.pax.carrot</groupId>
<artifactId>pax-carrot-htmlparser</artifactId>
<version>1.0.4</version>
</dependency>
import org.ops4j.pax.carrot.full.html.HtmlDocument;
import org.ops4j.pax.carrot.full.html.HtmlParser;
String html = "<html><body><h1>Hello, world!</h1></body></html>";
HtmlDocument document = HtmlParser.parse(html);
HtmlElement element = document.findElement("h1");
System.out.println(element.getTextContent());