Merging of two xml files

Questions about XML that are not covered by the other forums should go here.
Bhavana Boddu
Posts: 1
Joined: Mon Apr 16, 2007 1:33 pm
Location: Germany

Merging of two xml files

Post by Bhavana Boddu »

Hi,
i using Jdom.i have two xml files say sys1.xml and sys2.xml.
they contain following data:
sys1.xml

<application>
<source name="S0" >
<ports>
<outputport name="o1" />
</ports>
</source>
<task name="T0" >
<ports>
</ports>
</task>
<sink name="S1" >
<ports>
<inputport name=>
<inputrequirement>
</inputrequirement>
</inputport>
</ports>
</sink>
</application>


sys2.xml


<application>
<source name="S0" >
<ports>
<outputport name="o0" orientation="false"/>
</ports>
</source>
<task name="T0" >
<ports>

</ports>
</task>
<sink name="S1" >
<ports>
<inputport name="i0" orientation="false">
<inputrequirement>
</inputrequirement>
</inputport>
</ports>
</sink>
</application>

here the thing is i have to merge these two files and write in two 3 rd xml file.

points to note:
--suppose we take first xml file and add second one to it.
Attributes from second xml should be add to first one at same attributes in first xml.
--suppose if s0(source name) is already in sys1.xml and now you are adding sys2.xml.
now it should default take as s1.
-same case with sink also.
i wrote code but while getting the root of second one i am getting errror (root alredy exits)

can anyone help me for solving this problem.

bhavana.
bhavana
jkmyoung
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Post by jkmyoung »

Could you post the section of code where you are getting errors?
Post Reply