title: Convert a complex xls to xml
body: <p>I am trying to build an utility that shall convert a xls to xml. </p>
  
  <p>Below excel as you can see is denormailzed, contains list of lists and contains multiple relationship with parent and child. It  contains child elements that repeat more than once in a parent element body. Few elements have more than one attribute and not necessary all attributes are present for the same element. </p>
  
  <p>what kind of excel format do I have for such data that is easy to fill and easy to translate using java and supported libraries? </p>
  
  <p>Which library will be best suited? I have toyed with the idea of using libraries like (jxl.jar, javax.xml.*) however all these coding practices need a particular excel format which is hard to decide for this complex xml.</p>
  
  <p>Sample xml format is like below:</p>
  
  <pre><code>    &lt;req-template type="Req" spell-check="true" min-posting-days="0" min-internal-lead-days="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
   &lt;template-name&gt;&lt;![CDATA[Standard Requisition]]&gt;&lt;/template-name&gt;
   &lt;template-name lang="en_GB"&gt;&lt;![CDATA[Standard Requisition]]&gt;&lt;/template-name&gt;
    &lt;template-desc&gt;&lt;![CDATA[Standard Requisition]]&gt;&lt;/template-desc&gt;
    &lt;template-lastmodified&gt;1/7/15 3:00 AM&lt;/template-lastmodified&gt;
    &lt;default-listing-layout-id&gt;&lt;![CDATA[2]]&gt;&lt;/default-listing-layout-id&gt;
    &lt;field-definition id="id" type="text" required="false" custom="false"&gt;
    &lt;field-label&gt;&lt;![CDATA[Requisition ID]]&gt;&lt;/field-label&gt;
    &lt;field-label lang="en_GB"&gt;&lt;![CDATA[Requisition ID]]&gt;&lt;/field-label&gt;
    &lt;field-description&gt;&lt;![CDATA[Requisition Number]]&gt;&lt;/field-description&gt;
    &lt;field-description lang="en_GB"&gt;&lt;![CDATA[Requisition Number]]&gt;&lt;/field-description&gt;
    &lt;/field-definition&gt;
    &lt;field-definition id="status" type="picklist" required="true" custom="false"&gt;
    &lt;field-label&gt;&lt;![CDATA[Requition Status]]&gt;&lt;/field-label&gt;
    &lt;field-label lang="en_GB"&gt;&lt;![CDATA[Requition Status]]&gt;&lt;/field-label&gt;
    &lt;field-description&gt;&lt;![CDATA[For reporting purposes only.]]&gt;&lt;/field-description&gt;
    &lt;field-description lang="en_GB"&gt;&lt;![CDATA[For reporting purposes only.]]&gt;&lt;/field-description&gt;
      &lt;picklist-id&gt;reqStatus&lt;/picklist-id&gt;
    &lt;/field-definition&gt;
    &lt;field-definition id="instrDescription" type="instruction" required="false" custom="true"&gt;
    &lt;field-label mime-type="text-html"&gt;&lt;![CDATA[&lt;p&gt;&lt;br&gt;&lt;font face="Arial, Helvetica, sans-serif" color="blue"&gt;&lt;b&gt;Information Inherited from Position&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;]]&gt;&lt;/field-label&gt;
    &lt;field-label mime-type="text-html" lang="en_GB"&gt;&lt;![CDATA[&lt;p&gt;&lt;br&gt;&lt;font face="Arial, Helvetica, sans-serif" color="blue"&gt;&lt;b&gt;Information Inherited from Position&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;]]&gt;&lt;/field-label&gt;
    &lt;/field-definition&gt;
    &lt;field-definition id="title" type="text" required="true" custom="false"&gt;
    &lt;field-label&gt;&lt;![CDATA[Internal Title]]&gt;&lt;/field-label&gt;
    &lt;field-label lang="en_GB"&gt;&lt;![CDATA[Internal Title]]&gt;&lt;/field-label&gt;
    &lt;field-description&gt;&lt;![CDATA[Internal  Title]]&gt;&lt;/field-description&gt;
    &lt;field-description lang="en_GB"&gt;&lt;![CDATA[Internal Title]]&gt;&lt;/field-description&gt;
    &lt;/field-definition&gt;
    &lt;field-definition id="extTitle" type="text" required="false" custom="false"&gt;
    &lt;field-label&gt;&lt;![CDATA[External Title]]&gt;&lt;/field-label&gt;
    &lt;field-label lang="en_GB"&gt;&lt;![CDATA[External Title]]&gt;&lt;/field-label&gt;
    &lt;field-description&gt;&lt;![CDATA[External Title]]&gt;&lt;/field-description&gt;
    &lt;field-description lang="en_GB"&gt;&lt;![CDATA[External Title]]&gt;&lt;/field-description&gt;
    &lt;/field-definition&gt;
  </code></pre>
  
  <p>
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
        
  </p>
  
  <p>References:</p>
  
  <p><a href="http://www.javaworld.com/article/2076189/enterprise-java/book-excerpt--converting-xml-to-spreadsheet--and-vice-versa.html?page=3" rel="nofollow noreferrer">Sample program using javax.xml.* for normalized data</a></p>
  
  <p><a href="http://www.mkyong.com/java/jaxb-hello-world-example/" rel="nofollow noreferrer">Xml transformation using jaxb</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1900647/how-to-convert-excel-to-xml-using-java">Converting xls to xml using jxl.jar</a></p>
  
  <p>Thanks in advance!</p>