Remeber where you do stuff like
<cfset ThisNode = xmldoc.root.thechild>

Unlike arrays where the array is being copies ThisNode  is just a
reference to xmldoc.root.thechild.  Might be why you are getting the
the "WRONG_DOCUMENT_ERR: That node doesn't belong in this document."
It seems like I have read about people trying this before and could
not get it to work.

Adam H

On Thu, 2 Sep 2004 20:19:16 +0100, Adrian Lynch
<[EMAIL PROTECTED]> wrote:
> I'm not sure you can move a node from one doc to another. You might have to
> create a new node first and then extract the values from one doc and
> populate the second.
>
> Ade
>
> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: 02 September 2004 20:04
> To: CF-Talk
> Subject: RE: XML parsing in ColdFusion
>
> I'm still not getting this to work.  I tried using what you provided, but
> I'm only getting errors like the following.
>
> "WRONG_DOCUMENT_ERR: That node doesn't belong in this document."
>
> "Error casting an object of type to an incompatible type. This usually
> indicates a programming error in Java, although it could also mean you have
> tried to use a foreign object in a different way than it was designed."
>
> My test code:
>
> <cfxml variable="doc1">
> <root>
>        <member id="10">
>                <name>Ian</name>
>                <sex>male</sex>
>        </member>
> </root>
> </cfxml>
>
> <cfxml variable="doc2">
> <root>
>        <member id="1">
>                <name>Joe</name>
>                <sex>male</sex>
>        </member>
>        <member id="2">
>                <name>John</name>
>                <sex>male</sex>
>        </member>
>        <member id="3">
>                <name>Sue</name>
>                <sex>female</sex>
>        </member>
> </root>
> </cfxml>
>
> <!--- Three versions of this line I tried --->
> <cfset doc2.root.xmlChildren[4] = xmlElemNew(doc1, "member")><!--- Alternate
> 1 --->
> <cfset doc2.root.xmlChildren[4] = xmlElemNew(doc1.root, "member")><!---
> Alternate 2 --->
> <cfset doc2.root.xmlChildren[4] = xmlElemNew(doc1.root.member,
> "member")><!--- Alternate 3 --->
>
> <!--- If I code the line this way, I don't get an error, I do get a new
> member, but it is not populated.  If I could copy the member node from doc 1
> to this doc, then all would be well. But I can't seem to do that.--->
> <cfset doc2.root.xmlChildren[4] = xmlElemNew(doc2, "member")>
>
> <cfdump var="#doc2 #" label="Doc Two">
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to