My advice would be to use SimpleXML and MySqli, in PHP5. Here is some code I slapped together, I have not tested it, and there is no error correcting so you'll definitely want to do some work to it....
This is one of the reasons some people encourage leaving out the closing tag of your php (I don't). Also, as shorts noted, sometimes warnings will screw up your headers too. It's better to disable...