Re: SimpleXML add a node

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

 



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...
at any rate all my Exceptions are userland generated. like for instance when
any object is not of the right class I might throw an Exception.
Exceptions are really cool, but they are not are a replacement for var &
error checking.

behold the 'instanceof' keyword. it is good :-)
(free tip: javascript has a 'instanceof' keyword that is
indentical to the php keyword in usage, AFAICT).

the rest (xml) is all french to me :-/



-- 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