$url = "http://example.com/get-xml.php"; // contains broken XML
$file = file_get_contents($url);
$xml = simplexml_load_string($file);
Message received when simplexml_load_string is called:
"Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 216: parser error : Specification mandate value for attribute mods in"
Warning: simplexml_load_string() [function.simplexml-load-string]:
In summary, there's a XML tag with a space in it, and it's breaking everything.
So using PHP, I'm importing XML from a third party and the bad XML tag breaks the whole import. Is there a better way to read in the non-XML by looking at each specific XML tag? Or can I at least ignore the broken tags?
I guess ideally I would want a file_get_contents
method that shows the XML tag too. Any suggestions for a noob? I'm not able to change the 3rd party XML as I get it from a remote service I don't have any influence on.