开发者

Converting Excel to XML

I have hierchical data stored in a spreadsheet that I am converting into an xml using a Groovy script.

Col A   Col B

A         A1
A         A2
A         A2
B         B1
B         B1
B         B2

This needs to be as foll开发者_运维百科ows in XML format:

<A>
 <A1></A1>
 <A2></A2>
</A>
<B>
 <B1></B1>
 <B2></B2>
</B>

I have managed to do read it off the xls and write it to xml.I am having trouble associating A1 and A2 with a single element A My output currently looks like

<A>
 <A1></A1>
</A>
<A>
 <A2></A2>
</A>
<B>
 <B1></B1>
</B>
<B>
 <B2></B2>

What is a good programmatic way to read the excel?


Turned out to be fairly simple using a hash in groovy

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜