I was using one of the APIs to process their XML file using SimplePie, but it happens so that their XML document was invalid since one of the fields contained the ampersand character.
How did I resolve it? SimplePie accepts “set_raw_data($feed_string)” as one of its options. This means that you don’t have to use the URL to parse the feed.
So first, download the content of the XML through file_get_contents() method in PHP, then replace the string using str_replace(‘&’, ‘&’, $feed) and then you are safe to go.
I’m not entirely sure what other implications this has, but it’s serving me well so far.