fork download
  1. import java.io.IOException;
  2. import java.util.*;
  3.  
  4. import org.jsoup.Jsoup;
  5. import org.jsoup.nodes.Document;
  6. import org.jsoup.nodes.Element;
  7. import org.jsoup.select.Elements;
  8.  
  9. public class Parser {
  10. public static void main(String[] args) throws Exception {
  11. final ArrayTable<String, String, String> table = new ArrayTable<>();
  12. final Document doc = Jsoup.connect("http://localhost/index.html").userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
  13. .get();
  14. final Elements rows = doc.select("table tr");
  15. for(int r = 0; i < rows.size(); r++) {
  16. final List<Element> columns = rows.get(r).children().stream()
  17. .filter(e -> e.tagName() == "td" && e.attr("colspan") != "5")
  18. .collect(Collectors.toList());
  19. for (int c = 0; i < columns.size(); c++) table.setAt(r, c, columns.get(c).text());
  20. }
  21. System.out.println(table);
  22. }
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:17: error: illegal start of expression
				.filter(e -> e.tagName() == "td" && e.attr("colspan") != "5")
				           ^
1 error
stdout
Standard output is empty