Re: [xmljs-users] deep copy nodes between xml documents with JS
Brought to you by:
djoham,
witchhunter
|
From: David J. <dj...@ya...> - 2004-12-06 16:19:07
|
What XML do you get after your clone/import? I won't be able to look at this until tonight, but
what you're describing should work -at least on first inspection...
David
--- Barry Beattie <Ba...@al...> wrote:
> hi all
>
> I've got a simple xml doc loaded on a page. I then get an additional xml
> doc using the xmlhttprequest object.
>
> what I want to do is get a deep copy of a particular node from the
> additional doc and append it to the first one.
>
> I've tried importNode(), various combinations of cloneNode(), et all,
> but can't seem to snag it.
>
> can anyone see where I'm going wrong?
>
> thanx
> barry.b
>
>
> here's the JS, run after the xmlhttprequest object gets each additional
> doc
>
> function addAddressToMasterDoc(xmlAddress){
> var addressNode = xmlAddress.firstChild;
> masterXmlDoc.importNode(addressNode);
> }
>
>
>
> masterXmlDoc (before):
> =========================
> <entity id="12345" type="student">
> <fname>Fred</fname>
> <lname>Flintstone</lname>
> </entity>
>
>
> xmlAddress:
> =====================
> <address addrType="residential">
> <addr1>12 stone st</addr1>
> <addr2>Bedrock</addr2>
> </address>
>
> masterXmlDoc (after - what I'm trying to get):
> ==============================
> <entity id="12345" type="student">
> <fname>Fred</fname>
> <lname>Flintstone</lname>
> <address addrType="residential">
> <addr1>12 stone st</addr1>
> <addr2>Bedrock</addr2>
> </address>
> </entity>
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> xmljs-users mailing list
> xml...@li...
> https://lists.sourceforge.net/lists/listinfo/xmljs-users
>
|