Re: SimpleXML add a node

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

 



>> 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
return values of all these functions.

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

> Warning: DOMDocument::importNode() [function.importNode]: Cannot import:
> Node Type Not Supported in ...

So what's the Node Type (whatever that is) of the Node you are importing?

> Warning: appendChild() expects parameter 1 to be DOMNode, boolean given in
> ...
>
> Fatal error: Call to a member function appendChild() on a non-object in
> ...

-- 
Like Music?
http://l-i-e.com/artists.htm

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