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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:08:37+00:00 2026-05-25T22:08:37+00:00

i’m using JSoup to parse a webpage like this , and make it into

  • 0

i’m using JSoup to parse a webpage like this, and make it into two string arrays, one for each of the items text values (to be displayed in a ListActivity) and one for the links. some of these text values have special characters which jsoup has trouble parsing. at first i used:

Document doc = Jsoup.connect(URL).get();
maintable = doc.select(".kader").first();

to get the element for the table with the content. in another thread here someone said it would work using Jsoup.parse(html), so i changed it to this:

Document doc = Jsoup.connect(URL).get();
Document DOC = Jsoup.parse(doc.html());
if(doc.select(".kader") != null){
    maintable = DOC.select(".kader").first();
}

however this did not seem to work either. so i left that as something later to solve (here perhaps) but it is not my main problem.
if i try to get a String array of all the links displayed in the main content i would use this method:

public String[] getTranslationLinks(){
    String[] items = new String[alllinks.size()];
    Element tempelement;
    for(int i = 0;i<items.length;i++){
        tempelement = alllinks.get(i);

        items[i] = tempelement.attr("abs:href");
    }
    return items;
}

the debugger says that tempelement contains the proper element, but for some reason the .attr(“abs:href”) doesnt return the link as requested. tempelement would for instance contain:

<a href="./vertaling.php?id=6518" target="_top" title="">Hoofdstuk 3, tekst A: Herakles de slaaf</a>

but the .attr(abs:href) returns “”.

do any of you know a way to solve these problems?

  • 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-25T22:08:38+00:00Added an answer on May 25, 2026 at 10:08 pm

    Your best bet is to create a small compilable and runnable bit of code that demonstrates your problem, an SSCCE. For instance, when I created my SSCCE based on my interpretation of your problem, it seemed to work. This was the code:

    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 Kader {
       private static final String MAIN_URL = "http://www.latijnengrieks.com/categorie.php?id=120";
       private static final String ALL_LINKS = "a[href]";
       private static Element maintable;
    
       public static void main(String[] args) {
          Document jsDoc = null;
    
          try {
             jsDoc = Jsoup.connect(MAIN_URL).get();
             maintable = jsDoc.select(".kader").first();
    
             Elements alllinks = maintable.select(ALL_LINKS);
    
             String[] translationLinks = getTranslationLinks(alllinks);
    
             for (String tLink : translationLinks) {
                System.out.println(tLink);
             }
    
          } catch (IOException e) {
             e.printStackTrace();
          }
       }
    
       public static String[] getTranslationLinks(Elements alllinks){
          String[] items = new String[alllinks.size()];
          Element tempelement;
          for(int i = 0;i<items.length;i++){
              tempelement = alllinks.get(i);
    
              items[i] = tempelement.attr("abs:href");
          }
          return items;
      }
    }
    

    And this was the output:

    http://www.latijnengrieks.com/vertaling.php?id=5586
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6342
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6159
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5368
    http://www.latijnengrieks.com/profiel.php?id=11
    http://www.latijnengrieks.com/vertaling.php?id=5371
    http://www.latijnengrieks.com/profiel.php?id=11
    http://www.latijnengrieks.com/vertaling.php?id=5797
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6310
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5799
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5776
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5861
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5521
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5622
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5692
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6367
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5910
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6011
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5940
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6009
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5573
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5572
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5778
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5993
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5623
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5642
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6000
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5798
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=5578
    http://www.latijnengrieks.com/profiel.php?id=1
    http://www.latijnengrieks.com/vertaling.php?id=6415
    http://www.latijnengrieks.com/profiel.php?id=14
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm making a simple page using Google Maps API 3. My first. One marker

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.