1

I ran into a few questions on StackOverflow that asked about parsing html with xpath using Java.

This is the best answer I found so far here.

But it looks like DomSerializer is no longer available in Java 11.

How can I use DomSerializer in Java 11 ?

Anish B.
  • 9,111
  • 3
  • 21
  • 41
Arya
  • 8,473
  • 27
  • 105
  • 175

1 Answers1

2

Add the below dependency to the pom.xml :

<dependency>
    <groupId>net.sourceforge.htmlcleaner</groupId>
    <artifactId>htmlcleaner</artifactId>
    <version>2.6.1</version>
</dependency>

Or

You can download htmlcleaner-2.6.1.jar from here.

That jar (or artifact) has the DomSerializer class within it.

Link to read docs : http://htmlcleaner.sourceforge.net/doc/org/htmlcleaner/DomSerializer.html

Anish B.
  • 9,111
  • 3
  • 21
  • 41