xls数据文件转成xml格式的一种方法

首先你需要做一个映射模板,来映射xls文件中所有的列。
如下:

<?xmlversion="1.0"encoding="UTF-8"?>
<list>
<record>
<company></company>
<logo></logo>
<model></model>
<hight></hight>
<width></width>
<length></length>
<height></height>
<since></since>
<end></end>
<price></price>
<kind></kind>
<color></color>
<selection></selection>
<remarks></remarks>
</record>
<record>
<company></company>
<logo></logo>
<model></model>
<hight></hight>
<width></width>
<length></length>
<height></height>
<since></since>
<end></end>
<price></price>
<kind></kind>
<color></color>
<selection></selection>
<remarks></remarks>
</record>
</list>	
编辑好后,保存为test.xml.先用Excel打开你将要导出数据的.xls文件,【开发工具】-【源】右下角中有【xml映射】,进去后添加test.xml,手动对应好映射。(点击左边list的record,然后选中数据表中的第一列),导出即可。下面是导出的数据。


XML语言:高亮代码由发芽网提供
<?xmlversion="1.0"encoding="UTF-8"standalone="yes"?>
<listxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<record>
<company>アトラスピアノ�u造株式会社</company>
<logo>ADELSTEIN</logo>
<model>AD-ⅢM</model>
<hight>124</hight>
<width>63</width>
<length>151</length>
<height>250</height>
<since>1985年4月</since>
<end>1988年10月</end>
<price>780000</price>
<kind>アップライト</kind>
<color>マホガニ�`(桃花心木)</color>
<selection>なし</selection>
<remarks/>
</record>
<record>
<company>アトラスピアノ�u造株式会社</company>
<logo>ADELSTEIN</logo>
<model>AD-VⅢM</model>
<hight>132</hight>
<width>63</width>
<length>153</length>
<height>280</height>
<since>1985年4月</since>
<end>1988年10月</end>
<price>980000</price>
<kind>アップライト</kind>
<color>マホガニ�`(桃花心木)</color>
<selection>なし</selection>
<remarks/>
</record>

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念