Click to See Complete Forum and Search --> : Inserting Nodes between Nodes


cesarcesar
01-21-2008, 03:35 AM
Hi,

XML novice here with another question. I need to add a XML node like,


<child01>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
</child01>


into this node between the ending </child01> and beginning <child01> of the



<child01>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
</child01>
<child01>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
</child01>


Does this make sense? I guess im looking for a way to say/do... make a new node with the following values and place it between these other two nodes.

I still am learning XML but i think this can be done.

cesarcesar
01-21-2008, 04:05 AM
woops sorry, my 2nd XML is wrong. here is the correct.


<child01>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
</child01>
<child01>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
<child02>
<text></text>
<image>image 1</image>
<image>image 2</image>
</child02>
</child01>

Kor
01-21-2008, 04:10 AM
http://www.w3schools.com/dom/met_element_insertbefore.asp

cesarcesar
01-21-2008, 04:57 AM
one other thing... i want to do this in PHP if possible, but other languages are ok.