This is a great post on how to output make Joomla output a file as XML. This makes sure the headers are set correctly. The author provides files that should be put in your_joomla_site/libraries/joomla/document/ directory. Now, when you specify format=xml in the URL the headers are set correctly. Click here to view the article.