W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

Merge of two different XML documents

From: Gijun Lee <gijun@hotmail.com>
Date: Fri, 06 Jul 2001 15:30:41 -0000
To: www-dom@w3.org
Message-ID: <F1114FR0rmTIVvLVKi300006de5@hotmail.com>
Hi, there!

I just got started with XML::DOM. It is very good. But I don't see many 
examples on the internet site. That gets me in trouble. So, I am asking you 
for help!!!!

What I am trying to do is to merge two different XML documents. If I do the 
following thing, I get DOM Exception errors. It says that I am trying to do 
this from two different document sources. Looks okay to me, but it seems 
that I have to do something else to merge two different XML documents, but 
nowhere can I find an example for this. Will anybody know how to do this?


my $parser = new XML::DOM::Parser;
my $doc = $parser->parsefile ("foo.xml");
my $ctl_doc = $parser->parse("<Sample>This is a test</Sample>");

$jobrun_info_node = 
$doc->getElementsByTagName("JobRunInformation")->item(0);

$jobrun_info_node->appendChild($ctl_doc);

$doc->printToFile ("out.xml");


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
Received on Friday, 6 July 2001 11:31:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT