title: PHP Catching a SimpleXMLElement parse error
body: <p>I have a script that parses some XML (adf) stuff. Sometimes we receive broken XML data (ie- syntax, no ending tag, etc.).</p>
  
  <p><code>SimpleXMLElement</code> throws an error and kills my script, how could assign something like <code>$xml_body = new SimpleXMLElement ($adf_xml);</code> and catch the parse exception? </p>
  
  <hr>
  
  <blockquote>
    <p>Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home//Work//script/email_leads.php:46<br>
    Stack trace:<br>
    0 /home//Work//script/email_leads.php(46): SimpleXMLElement->__construct('&lt;?xml version="...')<br>
    1 /home//Work//script/email_leads.php(97): generateFeed()<br>
    2 {main}</p>
  </blockquote>