Loading data from XML: How to skip error in/incorrect XML file?

leesunset

New Member
I have in database several XML feeds which I regularly checking. How I do process data:I load these XML links from DB and in loop through the \[code\]simplexml_load_file()\[/code\] I am parsing data.But sometimes the script is terminated because of error caused by wrong format of XML file, for example: \[code\]Warning: simplexml_load_file() [function.simplexml-load-file]: URL_ADDRESS:1: parser error : Invalid XML encoding name in path_to_script on line 98Warning: simplexml_load_file() [function.simplexml-load-file]: <?xml version="1.0" encoding=""?> in path_to_scriptp on line 98Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in path_to_script on line 98Warning: Invalid argument supplied for foreach() in path_to_script on line 99\[/code\]Is there any way to handle this error and when an error is occurred, then would be this XML feed skipped and the script would continue with the next one?Thanks
 
Back
Top