xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dupras <bri...@centera.com>
Subject Merge multiple XML Docs into one XML Doc
Date Tue, 25 Jan 2000 18:16:16 GMT
OK - this should be an easy one, but so far I've yet to find a definitive
answer.


I have a system where I'm given multiple XML DOM Documents that I need to
process and merge into a single DOM Document.  The known portions of the
input Documents get processed, while the unknown portions need to be copied
over directly.


The question is, how do I properly insert entire nodes (and their childeren)
from one document to another?  Do I have to write my own recursive copy
routine?

I'm free to use either the DOM functions, or XSLT.


Brian


Given as DOM Documents:
	<doc1>
		<foo>
			<replaceme id="a"/>
		</foo>
		<bar/>
	</doc1>

	<doc2>
		<bar>
			<replaceme id="b">
			<inserthere thexml="doc1">
		</bar>
		<foo/>
	</doc2>

	<doc3>
		<inserthere thexml="doc1">
	</doc3>

	
Created from scratch:
	<output>
		<bar>
			<replaced>doc2 id b</replaced>
			<foo>
				<replaced>doc1 id a</replaced>
			</foo>
			<bar/>
		</bar>
	</output>





Brian Dupras
Centera Information Systems, Inc.
phone	303.939.0200 x294
fax	303.939.0111
web	http://www.centera.com
email	briand@centera.com

Mime
View raw message