@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")); }
@Test public void fetchToW3c() throws IOException { String url = "http://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")); }
private static Node getNodeFromString(String string) { return new W3CDom().fromJsoup(Jsoup.parse(string)); }