I am having trouble parsing invalid XML in PHP. In particular, I turn to a third-party web service that returns data in XML format without encoding XML objects in real data. For example, one of the elements contains an ASCII heart, "<3", without quotes, which the XML parser considers as an opening tag. It should be "& lt; 3".
Right now, I'm just passing an XML string to SimpleXMLElement, which, as expected, fails in these cases. I looked around a bit and it seems that the PHP Tidy package can help me, but the amount of configuration you can do is huge :(
So, Iām just wondering if anyone else has such a problem, and if so, how did they manage to solve it.
Thanks!
source
share