Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7097933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T10:59:44+00:00 2026-05-28T10:59:44+00:00

After successfully scraping the web with the relevent data I need to transfer it

  • 0

After successfully scraping the web with the relevent data I need to transfer it to an ArrayList.

As you can see below I printed out the data. Now all I need to do is put it in an ArrayList. Any idea?

Code:

static String html = "http://games.espn.go.com/fba/playerrater?&slotCategoryId=1";

public static void main(String[] args) throws IOException, SQLException, InterruptedException {
    Document doc = Jsoup.connect(html).get();
    String title = doc.title();
   System.out.println(title);


    Iterator<Element> trSIter = doc.select("table.playerTableTable").iterator();
    while (trSIter.hasNext()) {
        Element  trEl = trSIter.next().child(0);
        Elements  tdEls = trEl.children();
        Iterator<Element> tdIter = tdEls.select("tr").iterator();
        boolean firstRow = true;
        while (tdIter.hasNext()) {

            Element tr = (Element)tdIter.next();
            if (firstRow) {
                firstRow = false;
                continue;
            }

        while (tdIter.hasNext()) 
        {  

            System.out.println("============================");
            Element tdEl = tdIter.next();
            String name = 
                    tdEl.getElementsByClass("playertablePlayerName").text();
            System.out.println("Name: "+name);
            String pointStr = 
                    tdEl.getElementsByClass("sortedCell").text();
            System.out.println("points: "+pointStr);
            //System.out.println(tdEl);
            Elements tdsEls = tdEl.select("td.playertableData");
            Iterator<Element> columnIt = tdsEls.iterator();
            boolean firstRow1 = true;


            while(columnIt.hasNext())
            {


                Element column = columnIt.next();
                 String stat1 =column.text();
                System.out.print(column.className()+":"+column.text()+","); 

OUTPUT:

Name: Kobe Bryant, LAL SG
points: 14.68
playertableData:1,playertableData:0.62,playertableData:2.37,playertableData:1.36,playertableData:1.20,playertableData:2.66,playertableData:1.73,playertableData:0.15,playertableData:4.59,playertableData sortedCell:14.68,============================
Name: Joe Johnson, Atl SG, SF
points: 10.04
playertableData:2,playertableData:-0.58,playertableData:2.05,playertableData:3.27,playertableData:0.46,playertableData:1.41,playertableData:0.97,playertableData:0.01,playertableData:2.44,playertableData sortedCell:10.04,============================
Name: James Harden, OKC SG
points: 9.28
playertableData:3,playertableData:0.73,playertableData:2.48,playertableData:2.53,playertableData:0.53,playertableData:1.00,playertableData:0.46,playertableData:-0.25,playertableData:1.81,playertableData sortedCell:9.28,============================
Name: Andre Iguodala, Phi SF, SG
points: 8.74
playertableData:4,playertableData:0.42,playertableData:-1.47,playertableData:1.57,playertableData:1.31,playertableData:1.90,playertableData:3.13,playertableData:0.68,playertableData:1.19,playertableData sortedCell:8.74,============================
Name: Monta Ellis, GS PG, SG
points: 8.38
playertableData:5,playertableData:-0.58,playertableData:0.77,playertableData:1.15,playertableData:-0.14,playertableData:2.73,playertableData:2.11,playertableData:-0.12,playertableData:2.46,playertableData sortedCell:8.38,============================
Name: Kevin Martin, Hou SG
points: 7.87
playertableData:6,playertableData:-0.91,playertableData:3.01,playertableData:2.85,playertableData:0.02,playertableData:0.79,playertableData:0.46,playertableData:-0.66,playertableData:2.31,playertableData sortedCell:7.87,============================
Name: Jarrett Jack, Nor PG, SG
points: 7.67
playertableData:7,playertableData:0.15,playertableData:1.49,playertableData:0.51,playertableData:0.44,playertableData:3.25,playertableData:0.33,playertableData:-0.12,playertableData:1.62,playertableData sortedCell:7.67,============================
Name: Jason Terry, Dal SG
points: 7.31
playertableData:8,playertableData:-0.89,playertableData:0.77,playertableData:3.27,playertableData:-0.53,playertableData:1.41,playertableData:2.24,playertableData:-0.39,playertableData:1.42,playertableData sortedCell:7.31,============================
Name: Luke Ridnour, Min PG, SG
points: 6.21
playertableData:9,playertableData:1.05,playertableData:0.40,playertableData:1.57,playertableData:-0.37,playertableData:1.38,playertableData:1.22,playertableData:-0.12,playertableData:1.08,playertableData sortedCell:6.21,============================
Name: Ray Allen, Bos SG  DTD
points: 6.19
playertableData:10,playertableData:1.21,playertableData:1.35,playertableData:3.06,playertableData:-0.16,playertableData:0.31,playertableData:0.20,playertableData:-0.79,playertableData:1.01,playertableData sortedCell:6.19,============================
Name: Tyreke Evans, Sac PG, SG
points: 6.05
playertableData:11,playertableData:-1.04,playertableData:0.05,playertableData:0.19,playertableData:0.94,playertableData:1.90,playertableData:1.98,playertableData:0.15,playertableData:1.87,playertableData sortedCell:6.05,============================
Name: D.J. Augustin, Cha PG, SG  DTD
points: 5.88
playertableData:12,playertableData:-0.93,playertableData:0.73,playertableData:2.00,playertableData:0.07,playertableData:3.07,playertableData:0.33,playertableData:-0.66,playertableData:1.26,playertableData sortedCell:5.88,============================
Name: Wesley Matthews, Por SG, SF
points: 5.43
playertableData:13,playertableData:-0.80,playertableData:1.14,playertableData:2.32,playertableData:0.14,playertableData:-0.04,playertableData:1.86,playertableData:-0.39,playertableData:1.21,playertableData sortedCell:5.43,============================
Name: Brandon Knight, Det PG, SG
points: 5.38
playertableData:14,playertableData:-0.31,playertableData:0.46,playertableData:2.10,playertableData:0.30,playertableData:1.17,playertableData:0.84,playertableData:-0.39,playertableData:1.20,playertableData sortedCell:5.38,============================
Name: Paul George, Ind SF, SG
points: 5.37
playertableData:15,playertableData:0.04,playertableData:0.58,playertableData:1.79,playertableData:0.64,playertableData:0.38,playertableData:1.09,playertableData:0.28,playertableData:0.57,playertableData sortedCell:5.37,============================
Name: MarShon Brooks, NJ SG, SF  DTD
points: 5.22
playertableData:16,playertableData:0.67,playertableData:0.34,playertableData:1.26,playertableData:0.53,playertableData:0.03,playertableData:0.97,playertableData:0.01,playertableData:1.41,playertableData sortedCell:5.22,============================
Name: Paul Pierce, Bos SF, SG
points: 5.20
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T10:59:44+00:00Added an answer on May 28, 2026 at 10:59 am

    Make a class Player containing variables for name, points etc. Then create an object per player, finally add this to an ArrayList<Player>.

    Player currentPlayer;
    ArrayList<Player> players = new ArrayList<Player>();
    // a lot of your code
    while (tdIter.hasNext()) {  
        System.out.println("============================");
        Element tdEl = tdIter.next();
        currentPlayer = new Player();
        // instead of that:
        //String name = tdEl.getElementsByClass("playertablePlayerName").text();
        // do that:
        currentPlayer.mName = tdEl.getElementsByClass("playertablePlayerName").text();
        // the same with the rest of the gathered information
        // at the last line in this while loop
        players.add(currentPlayer);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After having successfully build a static data structure ( see here ), I would
I need to do some processing only after the user has successfully logged in
After successfully sent the URI to the web service from the push client, I
Is there any way to keep data on text input after successfully submitted the
After successfully acquiring a picture from the iPhone camera on iOS 4.1, you can
After successfully getting a list of specific types out of an assembly using reflection,
after successfully building my application the start fails because it relies on config files
I'm using NetDataContractSerializer . After successfully deserializing an object, is there a way to
I am using Struts application while running welcome page is run successfully after that
After following the advice in this question successfully, I added a couple additional lines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.