title: Spring Batch Writing to write a complex XML output
body: <p>I have to design a spring batch job which reads from database and write the data in to         XML the output format is as follows.</p>
  
  <p>Please suggest the spring batch configuration for Reader and writer.</p>
  
  <pre><code>&lt;Report&gt;
  &lt;ContentLocation&gt;I0001&lt;/ContentLocation&gt;
      &lt;Header documentId="Doc1"&gt;
        &lt;Mark&gt;e-mark&lt;/Mark&gt;
        &lt;EndDate&gt;2014-04-30 00:00:00&lt;/EndDate&gt;
        &lt;Type&gt;109&lt;/Type&gt;
        &lt;Business&gt;
          &lt;Id&gt;123456789&lt;/Id&gt;
          &lt;LegalName&gt;Company&lt;/LegalName&gt;
          &lt;LegalAddress&gt;12345 Main St. JamesTown CA 92869&lt;/LegalAddress&gt;
          &lt;LegalPhoneNumber&gt;567-678-8909&lt;/LegalPhoneNumber&gt;
        &lt;/Business&gt;
      &lt;/Header&gt;
  &lt;ITD documentId="34"&gt;
  &lt;Client&gt;
     &lt;Name&gt;Client1&lt;/Name&gt;
     &lt;Address&gt;Address1&lt;/Address&gt;
  &lt;/Client&gt;
  &lt;Associate&gt;
     &lt;Id&gt;1&lt;/Id&gt;
     &lt;Department&gt;Finance&lt;/Department&gt;
  &lt;/Associate&gt;
  &lt;Associate&gt;
     &lt;Id&gt;2&lt;/Id&gt;
     &lt;Department&gt;Accounts&lt;/Department&gt;
  &lt;/Associate&gt;
  &lt;/Itd&gt;
  &lt;/Report&gt;
  </code></pre>