I am using ROME library for parsing feeds. I want to know how can I identify a link as an XML link or a normal link. Is there a support for this in ROME.
A:
It sounds like you are saying that you will be getting a bunch of links from somewhere (RSS feed content or something). Then you want to go through them and determine if they are RSS/Atom feeds or if they are regular HTML pages.
You could probably attempt to fetch it with Rome and then see if it throws an exception. A better option might be to pull in the document at the end of each link and see what the header says it is.
Keep in mind that retrieving each link is may run into a problem if someone links to a very large file.
You might look at using the HEAD command to find out what type of file you are going to get at the end of a link before downloading the entire thing.
Seasoned
2009-09-21 23:22:20