Reply to Re: [PHP] SimpleXML add a node

Your name:

Reply:


Posted by Jochem Maas on 03/13/05 00:25

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

>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация