RE: [xmljs-users] deep copy nodes between xml documents with JS
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2004-12-16 04:44:11
|
Does this help? http://xmljs.sourceforge.net/website/documentation-w3cdom-DOMDocument.html#DOMDocumentImportNode I'm still baffled by what you're trying to do... David --- Barry Beattie <Ba...@al...> wrote: > > ach, I've narrowed it down. It's the adding of the other doc's element > to the fragment that it doesn't like > > // xmlToAdd and masterXmlDoc are both xml docs > > addrToAdd = xmlToAdd.documentElement; > doc_frag = masterXmlDoc.createDocumentFragment(); > doc_frag.appendChild(addrToAdd); ////// here \\\\\ > masterAddressRoot = > masterXmlDoc.getElementsByTagName("addresses").item(0); > masterAddressRoot.appendChild(doc_frag); > alert(masterXmlDoc); > > I've seen lots of examples where the "guts" of the fragment is created > (createElement) but no where is it an existing node of another doc. > > is this the correct reference to the other xml node? > > thanx > barry.b > > BTW, this works just fine > > addrToAdd = xmlToAdd.documentElement; > // get the parent the "address" node > masterAddressRoot = > masterXmlDoc.getElementsByTagName("addresses").item(0); > doc_frag = masterAddressRoot.importNode(addrToAdd, true); > masterAddressRoot.appendChild(doc_frag); > alert(masterXmlDoc); > > > > -----Original Message----- > From: David Joham [mailto:dj...@ya...] > Sent: Wednesday, 15 December 2004 2:13 AM > To: Barry Beattie; xml...@li... > Subject: RE: [xmljs-users] deep copy nodes between xml documents with JS > > > all I gotta do is turn "xmlFragment" (not a real DocumentFragment yet) > > into something I can insert into the master > > > > there isn't really a copyNode(deep) or insertFragment(node) is > there... > > Creating a DOMDocumentFragment and inserting it into the document using > the standard > append*/insert* methods should do the trick for you. > > http://xmljs.sourceforge.net/website/documentation-w3cdom-DOMDocument.ht > ml#DOMDocumentCreateDocumentFragment > > David > > > > ------------------------------------------------------- > 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 > |