Search in sources :

Example 1 with W3CDom

use of org.jsoup.helper.W3CDom in project jsoup by jhy.

the class UrlConnectTest method fetchToW3c.

@Test
public void fetchToW3c() throws IOException {
    String url = "https://jsoup.org";
    Document doc = Jsoup.connect(url).get();
    W3CDom dom = new W3CDom();
    org.w3c.dom.Document wDoc = dom.fromJsoup(doc);
    assertEquals(url, wDoc.getDocumentURI());
    String html = dom.asString(wDoc);
    assertTrue(html.contains("jsoup"));
}
Also used : W3CDom(org.jsoup.helper.W3CDom) Document(org.jsoup.nodes.Document) Test(org.junit.Test)

Aggregations

W3CDom (org.jsoup.helper.W3CDom)1 Document (org.jsoup.nodes.Document)1 Test (org.junit.Test)1