note 103058 modified in simplexmlelement.construct by danbrown

From: Date: Wed, 23 Mar 2011 15:45:09 +0000
Subject: note 103058 modified in simplexmlelement.construct by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178135@lists.php.net to get a copy of this message
Using libxml_use_internal_errors() may suppress errors but Exception still requires decent handling. I used following code snippet. <?php libxml_use_internal_errors(true); try{ $xmlToObject = new SimpleXMLElement($notSoWellFormedXML); } catch (Exception $e){ echo 'Please try again later...'; exit(); } ?> --was-- Using libxml_use_internal_errors() may suppress errors but Exception still requires decent handling. I used following code snippet. libxml_use_internal_errors(true); try{ $xmlToObject = new SimpleXMLElement($notSoWellFormedXML); } catch (Exception $e){ echo 'Please try again later...'; exit(); } http://php.net/manual/en/simplexmlelement.construct.php

« previous php.notes (#178135) next »