[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: i'd like to merge two docs ...

  • From: James Todd <jwtodd@p...>
  • To: Steve Muench <smuench@u...>
  • Date: Wed, 01 Dec 1999 22:44:36 -0800

xml dom merge

hmmm ... this is pretty much what i did with the exception of
the "removeChild()" step. my interpretation of this is that the
removeChild step will disassociate/null the OwnerDocument
so that it is effectively orphaned and can be added into the
new hosting doc.

i'll give it a whirl.

thx much,

- james

Steve Muench wrote:

> Assuming you have XML DOM Documents "one" and "two"
> and that "oneElement" is the element in doc "one"
> to which you'd like to append the entire content
> of "two"...
>
> You should be able to do:
>
>    Element twoDocElt = two.getDocumentElement();
>    two.removeChild(twoDocElt);
>    oneElement.appendChild(twoDocElt);
>
> _________________________________________________________
> Steve Muench, Consulting Product Manager & XML Evangelist
> Business Components for Java Development Team
> http://technet.oracle.com/tech/java
> http://technet.oracle.com/tech/xml
> ----- Original Message -----
> From: James Todd <jwtodd@p...>
> To: <xml-dev@i...>
> Sent: Wednesday, December 01, 1999 9:43 PM
> Subject: q: i'd like to merge two docs ...
>
> |
> | hi -
> |
> |     i could use a pointer or two, a recipe if you will, on how best to
> |     "modify and merge" two xml docs. the scenario:
> |
> |         an inbound xml "fragment", a complete xml doc in it's own
> |         right, is amended (eg. one new attribute is added)
> |
> |         the results of which is appended, as a child node, to a
> |         "hosting" xml tree
> |
> |     i've got most of this working using the ProjectX [? Mr. Brownell ?]
> |     parser yet it fails during the appendChild() stating that the child
> | node
> |
> |         "That node doesn't belong in this document"
> |
> |     due to the fact, i believe, that it has a distinct OwnerDocument.
> |
> |     my methodology to date is to create dom's for both the inbound
> |     "fragment" and the destination xml docs afterwhich i'd like to
> | modify
> |     the fragment (hence going the dom route) and finally add the results
> |
> |     to the destination doc via appendChild().
> |
> |     i had hoped to bypass walking the tree in order to create an
> |     "document ownerless" copy with which to work with. is there
> |     a better/preferred means by which to accomplish this task?
> |
> |     any/all comments and suggestions welcomed.
> |
> |     thx much,
> |
> | - james
> |
> |
> | xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
> | Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on
> CD-ROM/ISBN 981-02-3594-1
> | To unsubscribe, mailto:majordomo@i... the following message;
> | unsubscribe xml-dev
> | To subscribe to the digests, mailto:majordomo@i... the following
> message;
> | subscribe xml-dev-digest
> | List coordinator, Henry Rzepa (mailto:rzepa@i...)
> |
> |
>
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
> To unsubscribe, mailto:majordomo@i... the following message;
> unsubscribe xml-dev
> To subscribe to the digests, mailto:majordomo@i... the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@i...)


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.