Re: SimpleXML add a node

From: Date: Fri, 11 Mar 2005 23:42:33 +0000
Subject: Re: SimpleXML add a node
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-210568@lists.php.net to get a copy of this message
Richard Lynch wrote: ... >> >>} 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 > return values of all these functions. > Agreed 100%. No sense in going through the overhead of creating Exceptions (which are objects BTW) if you're not even going to use it in any way at all. Exceptions take a lot of work to build / manage so for small projects it's really not even worth the time. > >>It ist strange... It runs one time, the second time I receive the >>following >>error. > > > Since it "works" once and not the second time, I'd be looking to see if > the XML produced on the first go-around is actually VALID, since, if it's > not, that would cause this problem, I think. > A good point. Not only that... if you are trying to convert from simpleXML to DOM then you need dom_import_simplexml() http://php.net/manual/en/function.dom-import-simplexml.php -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.general (#210568) next »