<dependency>
<groupId>org.ops4j.pax.swissbox</groupId>
<artifactId>pax-swissbox-core</artifactId>
<version>1.8.1</version>
</dependency>
import org.ops4j.pax.carrot.maven.CarrotRunner;
import org.ops4j.pax.carrot.runner.CarrotRunnerFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class HTMLParserExample {
public static void main(String[] args) {
CarrotRunner runner = CarrotRunnerFactory.create("/path/to/html/document.html");
Element rootElement = runner.getDomDocument().getDocumentElement();
NodeList links = rootElement.getElementsByTagName("a");
for (int i = 0; i < links.getLength(); i++) {
Element linkElement = (Element) links.item(i);
String href = linkElement.getAttribute("href");
System.out.println(href);
}
}
}