Inserting Nodes between Nodes

Discussion in 'XML & RSS' started by cesarcesar, Jan 21, 2008.

  1. #1
    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>
    
    Code (markup):
    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>
    
    Code (markup):
    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. one other thing... i want to do this in PHP if possible, but other languages are ok.
     
    cesarcesar, Jan 21, 2008 IP
  2. cesarcesar

    cesarcesar Peon

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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>
    
    Code (markup):
     
    cesarcesar, Jan 21, 2008 IP