Thursday, 14 January 2016

XML : How can I escape data coming from simplexml_load_file

  simplexml_load_file($htmlstring)    

This is my simple pull from a third party database. We started pulling a comments section which unfortunately contains & and a few < which is barfing the xml build. Error is:

  Unescaped '&lt;' not allowed in attributes values    

How can I get to those incorrectly formatted results and CDATA them or something before it tried to build the XML set. I have looked all over http://php.net/manual/en/function.simplexml-load-file.php but dont seem to have the smarts to find a solution!

No comments:

Post a Comment