Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Inserting Nodes between Nodes
Old 01-21-2008, 03:35 AM Inserting Nodes between Nodes
Extreme Talker

Posts: 199
Trades: 0
Hi,

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

Code:
    <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


Code:
    <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. one other thing... i want to do this in PHP if possible, but other languages are ok.

Last edited by empiresolutions; 01-21-2008 at 04:55 AM..
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-21-2008, 03:56 AM Re: Inserting Nodes between Nodes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Your tags would be incorrectly nested in your example
Code:
    <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>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-21-2008, 04:01 AM Re: Inserting Nodes between Nodes
Extreme Talker

Posts: 199
Trades: 0
woops..

Code:
<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>
empiresolutions is offline
Reply With Quote
View Public Profile
 
Old 01-21-2008, 05:30 AM Re: Inserting Nodes between Nodes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
So you are looking for code to read the node structure and insert another <child02> element.
Not how to structure the nodes.

so a PHP question really
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-21-2008, 12:47 PM Re: Inserting Nodes between Nodes
Extreme Talker

Posts: 199
Trades: 0
Quote:
Originally Posted by chrishirst View Post
So you are looking for code to read the node structure and insert another <child02> element.
Not how to structure the nodes.

so a PHP question really
Yes, yes and yes
empiresolutions is offline
Reply With Quote
View Public Profile
 
Old 01-21-2008, 03:21 PM Re: Inserting Nodes between Nodes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
as in the other thread

take a look at Thierry's code class in

http://www.webmaster-talk.com/php-fo...unce-make.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-21-2008, 04:42 PM Re: Inserting Nodes between Nodes
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Ok...
Here, if you want a copy of the node, then cloneNode() [ http://www.php.net/manual/en/functio...-clonenode.php ] is the solution.

But first, tell me if it's really a copy of the node that you need, or just another node that may be similar or not to the previous.
Because I really don't see the logic here....
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Inserting Nodes between Nodes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.76753 seconds with 12 queries