Having sought clarification of the question, here is what you'll need to do:
- Check the URL is valid and fetch the contents.
- Validate the contents against the XML-based sitemap spec at http://www.sitemaps.org/protocol.html. This can best be done by defining classes that map to urlset and url and by de-serializing the XML to those types.
- If it's valid XML, then treat it as a sitemap.
- If it's invalid XML, you may wish to warn the user, or just treat it as a webpage.
- If not XML, you may treat it as a webpage.