Title: xml element append or something
Yeah, that code is copying only the first person node.
 
If you want to copy all of them you can wrap a loop around the outside of it and treat the person node as an array:
 

<!--- This step returns a java object rather than a ColdFusion XML Node --->

<cfloop from="1" to="#arrayLen(candidatesdoc.candidates.person)#" index="i">

<cfset newNode = candidatesdoc.candidates.person[i].cloneNode(true)>

<!--- Change the owner of the node --->

<cfset companyDoc.changeNodeOwner(newNode)>

<!--- Append it to its new parent --->

<cfset companydoc.company.employees.appendChild(newNode)>

</cfloop>

 
Spike
 
--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Taco Fleur
Sent: Wednesday, June 23, 2004 2:12 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: xml element append or something

I was going to say "ai ai you dirty little rascal, when you get back I'll buy you a beer" until I saw you made Barney disappear!!
 
It did a replace instead of an append.
 
Might have to add a new empty person element first??
-----Original Message-----
From: Stephen Milligan [mailto:[EMAIL PROTECTED]
Sent: Thursday, 24 June 2004 1:35 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: xml element append or something

Go have a look at my blog http://www.spike.org.uk/blog/index.cfm
 
I posted an entry about this a week or so ago.
 
Spike
 
--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Taco Fleur
Sent: Tuesday, June 22, 2004 8:02 PM
To: CFAussie Mailing List
Subject: [cfaussie] xml element append or something

Can't seem to figure the following out.

<cfxml variable="test1">
<logsummary xmlns="http://tempuri.org/logsummary.xsd">
    <error uuid="">
        <diagnostic occured="" firstoccurance="" lastoccurance="" fixedon=""></diagnostic>
        <comment></comment>
        <fix>
                <location></location>
        </fix>
    </error>
</logsummary>
</cfxml>

<cfxml variable="test2">
<logsummary xmlns="http://tempuri.org/logsummary.xsd">
    <error uuid="">
        <diagnostic occured="" firstoccurance="" lastoccurance="" fixedon=""></diagnostic>
        <comment></comment>
        <fix>
                <location></location>
        </fix>
    </error>
</logsummary>
</cfxml>

**************
I want to do something like
structInsert(test2.logsummary, "error", test1.logsummary.error);

Or
structAppend(test2.logsummary, test1.logsummary.error);

So I would end up with

<logsummary xmlns="http://tempuri.org/logsummary.xsd">
    <error uuid="">
        <diagnostic occured="" firstoccurance="" lastoccurance="" fixedon=""></diagnostic>
        <comment></comment>
        <fix>
                <location></location>
        </fix>
    </error>
    <error uuid="">
        <diagnostic occured="" firstoccurance="" lastoccurance="" fixedon=""></diagnostic>
        <comment></comment>
        <fix>
                <location></location>
        </fix>
    </error>
</logsummary>

is this possible?

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to