[xmljs-users] Re: xmljs-users digest, Vol 1 #50 - 2 msgs
Brought to you by:
djoham,
witchhunter
From: James S. E. <jam...@co...> - 2004-12-11 13:34:53
|
Barry, Do I understand you correctly as saying that you're creating the first DOM in <XML for Script> and the second DOM using the browser's native XmlHttpRequest object? If so, you can't copy nodes from one to the other because one is a JavaScript object and the other is an ActiveX or Mozilla object. The standard DOM methods may be the same, but the interfaces are implemented differently. James At 10:19 PM 12/6/2004, you wrote: >Send xmljs-users mailing list submissions to > xml...@li... > >To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/xmljs-users >or, via email, send a message with subject or body 'help' to > xml...@li... > >You can reach the person managing the list at > xml...@li... > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of xmljs-users digest..." > > >Today's Topics: > > 1. deep copy nodes between xml documents with JS (Barry Beattie) > 2. Re: deep copy nodes between xml documents with JS (David Joham) > >--__--__-- > >Message: 1 >Date: Mon, 6 Dec 2004 17:58:41 +1000 >From: "Barry Beattie" <Ba...@al...> >To: <xml...@li...> >Subject: [xmljs-users] deep copy nodes between xml documents with JS > >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 =3D xmlAddress.firstChild; > masterXmlDoc.importNode(addressNode); > }=20 > > > >masterXmlDoc (before): >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > ><entity id=3D"12345" type=3D"student"> > <fname>Fred</fname> > <lname>Flintstone</lname> ></entity> > > >xmlAddress: >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ><address addrType=3D"residential"> > <addr1>12 stone st</addr1> > <addr2>Bedrock</addr2> ></address> > >masterXmlDoc (after - what I'm trying to get): >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >=3D=3D=3D=3D=3D ><entity id=3D"12345" type=3D"student"> > <fname>Fred</fname> > <lname>Flintstone</lname> > <address addrType=3D"residential"> > <addr1>12 stone st</addr1> > <addr2>Bedrock</addr2> > </address> ></entity> > > > > >--__--__-- > >Message: 2 >Date: Mon, 6 Dec 2004 08:18:56 -0800 (PST) >From: David Joham <dj...@ya...> >Subject: Re: [xmljs-users] deep copy nodes between xml documents with JS >To: Barry Beattie <Ba...@al...>, xml...@li... > > >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 > > > > > > >--__--__-- > >_______________________________________________ >xmljs-users mailing list >xml...@li... >https://lists.sourceforge.net/lists/listinfo/xmljs-users > > >End of xmljs-users Digest |