File1
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<batch>
<constant1>one</constant1>
<constant2>two</constant2>
<constant3>three</constant3>
<data>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
</data>
</batch>
File2
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<batch>
<constant1>one</constant1>
<constant2>two</constant2>
<constant3>three</constant3>
<data>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
<d>aaaaaaaaaaa</d>
</data>
</batch>
Constant1, constant2, constant3 are common between files but elements inside data are the actual objects from DB
Need help to see how can i achieve this using java.Also, which xml generation way would be ideal?Tree based, stream or JAXB.
Thankyou