Extract and Parse HTML Table using Jsoup
html, java, jsoup, web-scraping
Solution
xpath for the columns - `//*[@id="phone_details"]/tbody/tr[3]/td[2]/strong`
xpath for the values - `//*[@id="phone_details"]/tbody/tr[3]/td[3]`
@Joey's code tries to zero in on these. You should be able to write the `select()` rules based on the Xpath.
Replace the numbers (tr[N] / td[N]) with appropriate values.
Alternatively, you can pipe the HTML thought a text only browser and extract the data from the text. Here is the text version of the page. You can delimit the text or read after N chars to extract the data.
Problem
How could I use Jsoup to extract specification data from this website separately for each row e.g. Network->Network Type, Battery etc. ``` import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class mobilereviews { public static void main(String[] args) throws Exception { Document doc = Jsoup.connect("http://mobilereviews.net/details-for-Motorola%20L7.htm").get(); for (Element table : doc.select("table")) { for (Element row : table.select("tr")) { Elements tds = row.select("td"); System.out.println(tds.get(0).text()); } } } } ```