Re: [PHP] SimpleXML add a node

2005-03-13 Thread Claudio
@richard 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. that sounds good, but , so far I know, if the API says that a function _can_ throw an exception, I

Re: [PHP] SimpleXML add a node

2005-03-12 Thread Jochem Maas
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); }

Re: [PHP] SimpleXML add a node

2005-03-12 Thread Jochem Maas
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 =

[PHP] SimpleXML add a node

2005-03-11 Thread Claudio
Hi, I probably have a stupid question... how can I add a node into an existing simplexml object. I create the object by $xml = simplexml_load_file('test.xml'); the xml file shows like this: ?xml version='1.0'? config /config Thanks for help... -- PHP General Mailing List

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Guillermo Rauch
php.net/dom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Claudio
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); }

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Richard Lynch
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); }

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Jason Barnett
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