|
Posted by b.coolsaet on 01/29/07 17:29
Hi,
like the title says simplexml is giving me a "Node no longer exists"
error while using the addChild() function. Note that it's not giving
an error on the first addChild();
Can somebody help ?
code causing error:
$xml = simplexml_load_file("../xml/books.xml");
if($xml) {
$book = $xml->books->addChild('book');
$book->addChild('title',$this->myTitle); //
line 171
$book->addChild('subtitle',$this->mySubTitle);
$book->addChild('publisher',$this->myPublisher);
$book->addChild('year',$this->myYear);
$book->addChild('cover',$this->cover);
$book->addChild('cover_thumb',$this->cover_thumb); // line 176
}
xml structure:
<books>
<book>
<title></title>
<subtitle></subtitle>
<publisher></publisher>
<year></year>
<cover></cover>
<cover_thumb></cover_thumb>
</book>
</books>
complete error:
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 171
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 172
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 173
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 174
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 175
Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-
addChild]: Node no longer exists in C:\Program Files\XAMPP\xampp\htdocs
\php\Book.class.php on line 176
Navigation:
[Reply to this message]
|