Yo!

I have a working form that adds user input to an XML file, it adds the new "item" element to the bottom of the list of previously created "item" elements. I would now like the new elements to be added to the top of the list. So far i've tried using: insertBefore() but i'm still getting elements added to the bottom.

The XML looks like:

<Clothes>
<Item>...</Item>
<Item>...</Item>
<Item>...</Item>
<----- new items are added here
<Clothes>

This is what my code looks like:

$y = $dom -> getElementsByTagName("item");
$dom -> documentElement -> insertBefore($Xitem,$y);

If trying to pass the top most "item" node to insertbefore() but without any luck. Any ideas ?

Cheers
Mongoose

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

Reply via email to