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?
Asked
Active
Viewed 4,510 times
1
-
1Can you give as some more details and / or code? – ollo May 05 '13 at 18:20
1 Answers
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: