Using Jsoup to print the content of HTML td, but the print stops at new york

39 Views Asked by At

I want to view the entire values of the webpage and then print each value, currently, my code stops at New York. How can I print out the entire data?

This is my webpage:

"https://studyinthestates.dhs.gov/sevis-data-mapping-tool/september-2023-stem-sevis-data-mapping-tool-data"

Last 2 print values:

NEW YORK NY MASTER'S SENEGAL FEMALE 3

NEW YORK NY MASTER'S

import org.jsoup.Jsoup;
import java.io.IOException;
import java.io.File;
import java.io.FileWriter;
import java.util.*;

public class myProjectDataExtracter {
    public static void main(String[] args) throws IOException{
        StringBuilder sb = new StringBuilder();
        //FileWriter myWriter 

        org.jsoup.nodes.Document doc = Jsoup.connect("https://studyinthestates.dhs.gov/sevis-data-mapping-tool/september-2023-stem-sevis-data-mapping-tool-data").get();
    
        for (org.jsoup.nodes.Element table : doc.select("table")) {
        for (org.jsoup.nodes.Element row : table.select("tr")) {
            org.jsoup.select.Elements tds = row.select("td");
                System.out.println(tds.text());
        }
    }

       String singleString = sb.toString();
      // System.out.println(singleString);
      // myWriter.write(singleString);
      // myWriter.close();
    }
}

I am expecting to print out the entire values of the td.

0

There are 0 best solutions below