问题描述
大家好,
我需要将excel文件转换为xml格式文件。
这可以通过使用MS excel本身提供的功能来完成。但是,我需要进行转换,以便将重复值分组并用XML标记。
以下是我的要求,
这是我的excel文件,
Hi All,
I need to convert a excel file into xml format file.
This can be done by using the feature available in MS excel itself. But, I need to convert such that the repetitive values grouped and tagged in XML.
Below is my requirement,
This is my excel file,
Last Name Sales Country Quarter
Smith $16,753.00 UK Qtr 3
Johnson $14,808.00 USA Qtr 4
Williams $10,644.00 UK Qtr 2
Jones $1,390.00 USA Qtr 3
Brown $4,865.00 USA Qtr 4
Williams $12,438.00 UK Qtr 1
Johnson $9,339.00 UK Qtr 2
Smith $18,919.00 USA Qtr 3
Jones $9,213.00 USA Qtr 4
Jones $7,433.00 UK Qtr 1
Brown $3,255.00 USA Qtr 2
Williams $14,867.00 USA Qtr 3
Williams $19,302.00 UK Qtr 4
Smith $9,698.00 USA Qtr 1
当它作为xml文件导出时,默认情况下会是,
When this is exported as xml file, it will by default come as,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<record>
<LastName>Smith</LastName>
<Sales>16753</Sales>
<Country>UK</Country>
<Quarter>Qtr 3</Quarter>
</record>
<record>
<LastName>Johnson</LastName>
<Sales>14808</Sales>
<Country>USA</Country>
<Quarter>Qtr 4</Quarter>
</record>
<record>
<LastName>Williams</LastName>
<Sales>10644</Sales>
<Country>UK</Country>
<Quarter>Qtr 2</Quarter>
</record>
<record>
<LastName>Jones</LastName>
<Sales>1390</Sales>
<Country>USA</Country>
<Quarter>Qtr 3</Quarter>
</record>
<record>
<LastName>Brown</LastName>
<Sales>4865</Sales>
<Country>USA</Country>
<Quarter>Qtr 4</Quarter>
</record>
<record>
<LastName>Williams</LastName>
<Sales>12438</Sales>
<Country>UK</Country>
<Quarter>Qtr 1</Quarter>
</record>
<record>
<LastName>Johnson</LastName>
<Sales>9339</Sales>
<Country>UK</Country>
<Quarter>Qtr 2</Quarter>
</record>
<record>
<LastName>Smith</LastName>
<Sales>18919</Sales>
<Country>USA</Country>
<Quarter>Qtr 3</Quarter>
</record>
<record>
<LastName>Jones</LastName>
<Sales>9213</Sales>
<Country>USA</Country>
<Quarter>Qtr 4</Quarter>
</record>
<record>
<LastName>Jones</LastName>
<Sales>7433</Sales>
<Country>UK</Country>
<Quarter>Qtr 1</Quarter>
</record>
<record>
<LastName>Brown</LastName>
<Sales>3255</Sales>
<Country>USA</Country>
<Quarter>Qtr 2</Quarter>
</record>
<record>
<LastName>Williams</LastName>
<Sales>14867</Sales>
<Country>USA</Country>
<Quarter>Qtr 3</Quarter>
</record>
<record>
<LastName>Williams</LastName>
<Sales>19302</Sales>
<Country>UK</Country>
<Quarter>Qtr 4</Quarter>
</record>
<record>
<LastName>Smith</LastName>
<Sales>9698</Sales>
<Country>USA</Country>
<Quarter>Qtr 1</Quarter>
</record>
</data-set>
但是我想要这样,
例如< lastname> Smith在这个xml脚本中出现了三次,但我希望该标签只出现一次,其余标签Sales,Country,Quarter应该在LastName标签内重复三次。
我是这个XML的新手所以我对此感到困惑。
引导我这个。
问候,
Shivakumar A
But I want such that,
take for example <lastname>Smith comes thrice in this xml script, but I want that tag to appear just once, and the remaining tags Sales, Country, Quarter should get repeated thrice within LastName tag.
I am new to this XML, so I am bit confused on this.
Guide me out on this.
Regards,
Shivakumar A
推荐答案
这篇关于如何将MS excel 2010文件转换为XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!