将复杂的xls转换为xml

时间:2016-04-28 09:59:52

标签: java xml jaxb xls jxl

我正在尝试构建一个将xls转换为xml的实用程序。

在excel下面,你可以看到denormailzed,包含列表列表,并包含与父母和孩子的多种关系。它包含在父元素主体中重复多次的子元素。很少有元素具有多个属性,并且不必为同一元素存在所有属性。

我对这些易于填充且易于使用java和支持的库进行翻译的数据采用何种excel格式?

哪个库最适合?我已经玩弄了使用像(jxl.jar,javax.xml。*)这样的库的想法,但是所有这些编码实践都需要一个特殊的excel格式,这个格式很难为这个复杂的xml决定。

示例xml格式如下所示:

    <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">
 <template-name><![CDATA[Standard Requisition]]></template-name>
 <template-name lang="en_GB"><![CDATA[Standard Requisition]]></template-name>
  <template-desc><![CDATA[Standard Requisition]]></template-desc>
  <template-lastmodified>1/7/15 3:00 AM</template-lastmodified>
  <default-listing-layout-id><![CDATA[2]]></default-listing-layout-id>
  <field-definition id="id" type="text" required="false" custom="false">
  <field-label><![CDATA[Requisition ID]]></field-label>
  <field-label lang="en_GB"><![CDATA[Requisition ID]]></field-label>
  <field-description><![CDATA[Requisition Number]]></field-description>
  <field-description lang="en_GB"><![CDATA[Requisition Number]]></field-description>
  </field-definition>
  <field-definition id="status" type="picklist" required="true" custom="false">
  <field-label><![CDATA[Requition Status]]></field-label>
  <field-label lang="en_GB"><![CDATA[Requition Status]]></field-label>
  <field-description><![CDATA[For reporting purposes only.]]></field-description>
  <field-description lang="en_GB"><![CDATA[For reporting purposes only.]]></field-description>
    <picklist-id>reqStatus</picklist-id>
  </field-definition>
  <field-definition id="instrDescription" type="instruction" required="false" custom="true">
  <field-label mime-type="text-html"><![CDATA[<p><br><font face="Arial, Helvetica, sans-serif" color="blue"><b>Information Inherited from Position</b></font></p>]]></field-label>
  <field-label mime-type="text-html" lang="en_GB"><![CDATA[<p><br><font face="Arial, Helvetica, sans-serif" color="blue"><b>Information Inherited from Position</b></font></p>]]></field-label>
  </field-definition>
  <field-definition id="title" type="text" required="true" custom="false">
  <field-label><![CDATA[Internal Title]]></field-label>
  <field-label lang="en_GB"><![CDATA[Internal Title]]></field-label>
  <field-description><![CDATA[Internal  Title]]></field-description>
  <field-description lang="en_GB"><![CDATA[Internal Title]]></field-description>
  </field-definition>
  <field-definition id="extTitle" type="text" required="false" custom="false">
  <field-label><![CDATA[External Title]]></field-label>
  <field-label lang="en_GB"><![CDATA[External Title]]></field-label>
  <field-description><![CDATA[External Title]]></field-description>
  <field-description lang="en_GB"><![CDATA[External Title]]></field-description>
  </field-definition>

                                                                                                                         

参考文献:

Sample program using javax.xml.* for normalized data

Xml transformation using jaxb

Converting xls to xml using jxl.jar

提前致谢!

0 个答案:

没有答案