【发布时间】:2012-08-20 15:16:20
【问题描述】:
我遇到了这个问题。我有大约 10k 个包含一堆性能数据的 xml 文件。我需要parce,然后将它们导入excel,这样我就可以从中生成一个图表。
我正在尝试确定解决此问题的最佳方法。我无法直接导入,因为 excel 无法将其识别为有效的 xml 格式。 (excel给了我无法识别的架构或某些东西)
文件格式是这样的:(我只包含了有用的信息。) 文件名如下所示:YYDDMM.startOfPMPeriod_endOfPMPeriod 并在文件中:
<time stamp>
<PM category1>
<PM category2>
<PM category3>
...
<sub system 1>
<result>1</result>
<result>2.0</result>
...
<sub system 2>
<result>0.221</result>
<result>2.0</result>
...
<sub system n>
<result>1</result>
<result>2.0</result>
这些文件大约有 10k 个。每个文件大约有 6k 行。 :)
我不确定如何处理这个问题。我明白了它的基本逻辑:
while (we got more files to read)
read a file
parse PM category and timestamp
while (not end of file)
reading in results data and the subsystems
//store it in an array of some sort, but I am not sure about the structure of it
//once we are done with our files
pass the array to excel, (somehow, maybe as a CSV?)
你们认为解决这个问题的最佳方法是什么?我的编程能力有限。我熟悉 java、c++ 和 bash 脚本。 3维数组超出了我的范围。我在二维方面遇到了足够的麻烦。 :) 我最复杂的任务是用 java 制作一个多线程的银行应用程序。
戴维
更新:它适用于 excel 2003 excel表格应该是这样的:我不能附上图片,所以你必须这样做:
timestamp 1 timestamp2 timestamp 3
subsystem 1 pm cat 1
pm cat 2
pm cat 3
subsystem 2 pm cat 1
pm cat 2
pm cat 3
【问题讨论】:
-
操作,我真傻。 Excel 2003。
标签: xml parsing architecture excel-2003