I am writing an RSS parser. Is there any way to find if the given URL is RSS or atom using Java?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You could use ROME (I suggest that first) for parsing RSS and Atom Feeds. Alternatively, you’ll have to use a SAX parser or create a DOM tree and do the following:
For RSS:
In RSS, you will have to check that there’s a
rsselement, and it’s child must contain achannelelement. There can be 0 or moreitemin RSS (I might be wrong).Example:
For Atom:
In Atom, you will have to check that there’s a
feedelement. There can be 0 or moreentryin Atom. (I might be wrong).Example:
PS: I don’t know which RSS version or Atom version you want to implement, but follow their guidelines.