Skip to content

Commit 2fa33a4

Browse files
Eric FJEric FJ
Eric FJ
authored and
Eric FJ
committed
Change activity due to packtpub.com changing
1 parent 464e047 commit 2fa33a4

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.packtpub.http;
2+
3+
import org.jsoup.Jsoup;
4+
import org.jsoup.nodes.Document;
5+
import org.jsoup.nodes.Element;
6+
import org.jsoup.select.Elements;
7+
8+
import java.io.IOException;
9+
10+
public class Activity1 {
11+
12+
public static void main(String[] args) {
13+
14+
try {
15+
String url = "http://hc.apache.org/";
16+
17+
Document doc =
18+
Jsoup.connect(url).get();
19+
20+
Elements sections = doc.select("div.section");
21+
22+
for (Element div : sections) {
23+
24+
for (Element child : div.children()) {
25+
String tag = child.tagName();
26+
if (tag.equalsIgnoreCase("h3")) {
27+
28+
Elements links = child.getElementsByTag("a");
29+
for (Element link : links) {
30+
System.out.println(link.text());
31+
}
32+
}
33+
}
34+
}
35+
} catch (IOException e) {
36+
e.printStackTrace();
37+
}
38+
}
39+
}

Chapter09/src/main/java/com/packtpub/http/ActivityPacktpub.java

-26
This file was deleted.

0 commit comments

Comments
 (0)