1

I'm using Jsoup to parse xml, I have to grab links from an RSS feed such as this http://feeds.guardian.co.uk/theguardian/rss , I just need advise on how to go about this in Java, I know how to parse a single line , but how would I go about grabbing all the links?

1
  • 1
    Can you give as some more details and / or code? Commented May 5, 2013 at 18:20

1 Answer 1

2

You can select links with the Jsoup selector api (see here).

In most cases your code will look something like this:

Document doc = Jsoup.connect(url).get(); // connect to url and parse its conntent into a document

Elements elements = doc.select("your selector string"); // select your elements from the document


for( Element element : elements ) // iterate over each elements you've selected
{
    // do something
}

See also:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.