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 7995823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:32:04+00:00 2026-06-04T14:32:04+00:00

I am working on a project where I am trying to fetch financial statements

  • 0

I am working on a project where I am trying to fetch financial statements from the internet and use them in a JAVA application to automatically create ratios, and charts.

The site I am using uses a login and password to get to the tables.
The Tag is TBODY, but there are 2 other TBODY’s in the html.

How can I use java to print my table to a txt file where I can then use in my application?
What would the best way to go about this, and what should I read up on?

  • 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-06-04T14:32:08+00:00Added an answer on June 4, 2026 at 2:32 pm

    If this were my project, I’d look into using an HTML parser, something like jsoup (although others are available). The jsoup site has a tutorial, and after playing with it a while, you’ll likely find it pretty easy to use.

    For example, for an HTML table like so:

    enter image description here

    jsoup could parse it like so:

    import java.io.IOException;
    import org.jsoup.Jsoup;
    import org.jsoup.nodes.Document;
    import org.jsoup.nodes.Element;
    import org.jsoup.select.Elements;
    
    public class TableEg {
       public static void main(String[] args) {
          String html = "http://publib.boulder.ibm.com/infocenter/iadthelp/v7r1/topic/" +
                "com.ibm.etools.iseries.toolbox.doc/htmtblex.htm";
          try {
             Document doc = Jsoup.connect(html).get();
             Elements tableElements = doc.select("table");
    
             Elements tableHeaderEles = tableElements.select("thead tr th");
             System.out.println("headers");
             for (int i = 0; i < tableHeaderEles.size(); i++) {
                System.out.println(tableHeaderEles.get(i).text());
             }
             System.out.println();
    
             Elements tableRowElements = tableElements.select(":not(thead) tr");
    
             for (int i = 0; i < tableRowElements.size(); i++) {
                Element row = tableRowElements.get(i);
                System.out.println("row");
                Elements rowItems = row.select("td");
                for (int j = 0; j < rowItems.size(); j++) {
                   System.out.println(rowItems.get(j).text());
                }
                System.out.println();
             }
    
          } catch (IOException e) {
             e.printStackTrace();
          }
       }
    }
    

    Resulting in the following output:

    headers
    ACCOUNT
    NAME
    BALANCE
    
    row
    0000001
    Customer1
    100.00
    
    row
    0000002
    Customer2
    200.00
    
    row
    0000003
    Customer3
    550.00
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project and trying to use JavaScript for validating all inputs
I have a working project that Im amending, it crashes after trying to use
I'm working on a project that is trying to use context-free grammars for parsing
I am working on an Actionscript 2 project - trying to use the XML
I am working on a project using Spring. I am trying to fetch a
I am working on a project and trying to use pthread_cond_wait() and pthread_cond_signal() to
I'm working on a project and trying to render some images sitting under the
I am working on a VB.Net project and trying to get it to pull
I have a project working fine under MSVS 2010 SP1. I'm trying to convert
I'm currently working on a ASP.Net 3.5 project and trying to implement session timeout

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.