Hi foks,

Could someone lend me a little hand with simpleXML ?
I've been looking at examples in the PHP manual and W3C, i'm at the pinnacle of figuring it out but alas i need a hand from the mailing list dudes.

My aim is to add another "item" node, so i'll start with my XML file called "items.xml"


<?xml version="1.0" encoding="iso-8859-1"?>

    <name>Red Gloves</name>
    <desc>a pair of red gloves</desc>

    <name>Snow Boots</name>
    <desc>some snow boots</desc>


And now the PHP i'm using to create a new "item" node:

$xml = simplexml_load_file('items.xml');

$item = $xml->clothes->addChild('item');
$item->addChild('name', 'blue gloves');
$item->addChild('desc', 'some blue gloves');
$item->addChild('size', 'adult');
$item->addChild('price', '4.99');


The error i'm getting is: "Cannot add child. Parent is not a permanent member of the XML tree"

Help me Gamesmaster!

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to