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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:11:19+00:00 2026-05-26T10:11:19+00:00

I am trying to parse a webpage, the values i want to parse are

  • 0

I am trying to parse a webpage, the values i want to parse are included in certain TD tags.
Can someone please help me to get along? I am getting a syntax error line1 column62.

Goal is to pass the values to a listview later on, so that it shows Nieuw beltegoed: € 2,50

Any help would be appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl">
<head>
<TABLE class=personaltable cellSpacing=0 cellPadding=0>
 <TBODY>
  <TR class=alternativerow>
   <TD>Nieuw beltegoed:</TD>
   <TD>€ 2,50</TD>
  </TR>
  <TR>
   <TD>Tegoed vorige periode:</TD>
   <TD>€ 3,62</TD>
  </TR>
  <TR class=alternativerow>
   <TD>Tegoed tot 09-11-2011:</TD>
   <TD>€ 1,12</TD>    
  </TR>
  <TR>
   <TD>
   <TD height=25></TD>
  <TR class=alternativerow>
   <TD>Verbruik sinds nieuw tegoed:</TD>
   <TD>€ 3,33</TD>
  </TR>
  <TR>
   <TD>Ongebruikt tegoed:</TD>
   <TD>€ 1,79</TD>
  </TR>
  <TR class=alternativerow>
   <TD class=f-Orange>Verbruik boven bundel:</TD>
   <TD class=f-Orange>€ 0,00</TD>
  </TR>
  <TR>
   <TD>Verbruik dat niet in de bundel zit*:</TD>
   <TD>€ 0,00</TD>
  </TR>
 </TBODY>
</TABLE>
</head>

My Saxhandler so far:

// ===========================================================
    // Fields
    // ===========================================================

    private boolean in_TABLE = false;
    private boolean in_TBODY = false;
    private boolean in_TR = false;
    private boolean in_TD = false;

    private ParsedExampleDataSet myParsedExampleDataSet = new ParsedExampleDataSet();

    // ===========================================================
    // Getter & Setter
    // ===========================================================

    public ParsedExampleDataSet getParsedData() {
            return this.myParsedExampleDataSet;
    }

    // ===========================================================
    // Methods
    // ===========================================================
    @Override
    public void startDocument() throws SAXException {
            this.myParsedExampleDataSet = new ParsedExampleDataSet();
    }

    @Override
    public void endDocument() throws SAXException {
            // Nothing to do
    }

    /** Gets be called on opening tags like: 
     * <tag> 
     * Can provide attribute(s), when xml was like:
     * <tag attribute="attributeValue">*/
    @Override
    public void startElement(String namespaceURI, String localName,
                    String qName, Attributes atts) throws SAXException {
            if (localName.equals("TABLE class=personaltable cellSpacing=0 cellPadding=0")) {
                    this.in_TABLE = true;
            }else if (localName.equals("TBODY")) {
                    this.in_TBODY = true;
            }else if (localName.equals("TR class=alternativerow")) {
                    this.in_TR = true;
            }else if (localName.equals("TD")) {
                    // Extract an Attribute
                    String attrValue = atts.getValue("TD");
                    int i = Integer.parseInt(attrValue);
                    myParsedExampleDataSet.setExtractedInt(i);
            }
    }

    /** Gets be called on closing tags like: 
     * </tag> */
    @Override
    public void endElement(String namespaceURI, String localName, String qName)
                    throws SAXException {
            if (localName.equals("TABLE class=personaltable cellSpacing=0 cellPadding=0")) {
                    this.in_TABLE = false;
            }else if (localName.equals("TBODY")) {
                    this.in_TBODY = false;
            }else if (localName.equals("TR class=alternativerow")) {
                    this.in_TR = false;
            }else if (localName.equals("TD")) {
                    // Nothing to do here
            }
    }

    /** Gets be called on the following structure: 
     * <tag>characters</tag> */
    @Override
public void characters(char ch[], int start, int length) {
            if(this.in_TD){
            myParsedExampleDataSet.setExtractedString(new String(ch, start, length));
    }
}
  • 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-26T10:11:20+00:00Added an answer on May 26, 2026 at 10:11 am

    to parse HTML page it is easier to use dom than SAX.

    Also you can check this post it is answered how to parse html page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse a webpage using Java with URLConnection. I try to set
Trying to parse Maplines for an airport. Each airport can have X number of
I'm trying to download data from a webpage then parse it, the problem is
I'm trying to parse the HTML of a webpage that requires being logged in.
I'm trying to parse a webpage using open-uri + hpricot but it seems to
I am just trying to write a small web page that can parse some
i'm trying to get web-page data in string that than i could parse it.
I am trying to parse the HTML of a webpage to DOM by loading
I'm trying to get data from a webpage that serves a XML file periodically
I was trying to download and parse a webpage with foreign (Chinese) characters. I'm

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.