simpleXML - can't add children - why? - stuck

[email protected] (MEM)
Newsgroups php.general
Message-ID <[email protected]>
Hello all,

I'm struggling here, but no joy so far.

Having this XML file that I'm loading using simplexml_load_file():
http://pastebin.com/JiW3LxWM

I need to add some <domain:create> children nodes after line 8.

What do I need to add?
This:
http://pastebin.com/mT27g3ZN

In order to do so, I have used the following php snipped:
http://pastebin.com/a1gG8tXx

I'm getting this warning and, after it, a fatal error:
Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild]:
Cannot add child. Parent is not a permanent member of the XML tree.
(line number 1 of last paste bin)

Fatal error: Call to a member function addChild() on a non-object
(line number 2 of last paste bin)

Note that:
The constant used is correct. The php version is higher then 5.1.
On the same command, later on this code, I was able to create child
nodes with no issues.

I'm far (veery far) from being a guru, so please, what can I do to
debug this, and find out what's going on?


Thanks a lot,
Márcio
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.