I believe this has to do with the fact that an XML element knows it's parent.

So you may have to do something like:

<cfscript>
aryDetails =  xmlSearch(firstPageXml,
              "/shell/page[1]//[EMAIL PROTECTED]'#SECTION_NAME#']");
aryDetails = aryDetails[1]; //just for convenience
tempElem = XmlElemNew(attributes.xmlDoc, "myelemname");
tempElem.attributes = aryDetails.attributes;
tempElem.xmlchildren = aryDetails.xmlchildren;
tempElem.xmlText = aryDetails.xmlText;
ArrayInsertAt(attributes.xmlDoc.XmlRoot.XmlChildren[1].XmlChildren,
              1, 
              tempElem);
</cfscript>

This is totally untested - but may work ;o)

Mark

------------------------------------------------------------------
[EMAIL PROTECTED]
ICQ: 3094740
Safe From Bees
[ www.safefrombees.com ]


Quoting Gavo <[EMAIL PROTECTED]>:

> Hello, Can anyone tell me why I am getting an error when i am extracting a
> node from one xml document and insert it into another the code is as follows
> 
> <cfset aryDetails =
> xmlSearch(firstPageXml,"/shell/page[1]//[EMAIL PROTECTED]'#SECTION_NAME
> #']") >
> <cfset ArrayInsertAt( attributes.xmlDoc.XmlRoot.XmlChildren[1].XmlChildren,
> 1, aryDetails[1])>
> 
> If I do the same with the same xml document it doesnt error. I have been
> trying to figure this out for a while now and its starting to drive me
> crazy!!!
> 
> The error is as follows:-
> 
> WRONG_DOCUMENT_ERR: That node doesn't belong in this document.
> 
> Any help would be appreciated!
> 
> 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to