Re: SimpleXML add a node

From: Date: Sun, 13 Mar 2005 00:27:59 +0000
Subject: Re: SimpleXML add a node
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-210602@lists.php.net to get a copy of this message
Jochem Maas wrote:
Richard Lynch wrote:
php.net/dom
?? Like this? --- try { $dom = new DOMDocument(); $config = $dom->appendChild($dom->importNode(dom_import_simplexml($this->configXML),true)); $config->appendChild( $dom->createElement(($mode? 'softactive':'active')) ); $this->configXML = simplexml_import_dom($config); } catch(Exception $e) {}
I dunno about that whole try/catch thing, but if you're not going to USE it to catch the errors, then you might as well be old school and check the
the try/catch block only catch exceptions, you still have to handle the std errors as normally would - for the old school its business as usual, only this simester there are a couple of new kids in the class :-). I'm pretty sure there was alot of discussion about whether to throw exceptions or trigger errors in the new php5 extensions. I can't actually think of any place in php5 or the extensions I use where the engine throws an Exceptions...
I happened upon atleast one place where you can have the engine throw Exceptions iso triggering errors this: $db->setAttribute( PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION ); I found here; http://wiki.cc/php/PDO_Basics ...

« previous php.general (#210602) next »