Re: SimpleXML add a node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux