请教诸位大侠一个有关xml的问题,老美限我二十四小时内解决,请大伙多多帮忙提供一个思路啦
今天中午收到老美的题目,限定在二十四小时内解决,请大伙帮忙啦
题目是
Attached please find two *.txt files. The TestLog.txt is something pulled
from our test tool, and now I want to generate an output file like what you see in
TestResults.txt
Give me brief description on how you attack this problem and possible solutions.
TestLog.txt文件如下:
<?xml version="1.0" encoding="UTF-8" ?>
- <TestLog>
- <LogEvent ID="Computer Start">
- <LogEventProperty Name="Event Type" ID="Event Type">
- <![CDATA[ Computer Start
]]>
</LogEventProperty>
- <LogEventProperty Name="Start Date" ID="Start Date">
- <![CDATA[ 01/08/2003
]]>
</LogEventProperty>
- <LogEventProperty Name="Start Time" ID="Start Time">
- <![CDATA[ 10:23:25
]]>
</LogEventProperty>
+ <LogEventProperty Name="End Date" ID="End Date">
- <![CDATA[ 01/08/2003
]]>
</LogEventProperty>
- <LogEventProperty Name="End Time" ID="End Time">
- <![CDATA[ 10:23:25
]]>
</LogEventProperty>
- <LogEventProperty Name="Result" ID="Result">
- <![CDATA[ Fail
]]>
</LogEventProperty>
- <LogEventProperty Name="Failure Reason" ID="Failure Reason">
- <![CDATA[
]]>
</LogEventProperty>
<LogEventProperty Name="Failure Description" ID="Failure Description" />
- <LogEventProperty Name="Error File" ID="Error File">
- <![CDATA[ e000
]]>
</LogEventProperty>
- <LogEventProperty Name="Output File" ID="Output File">
- <![CDATA[ o000
]]>
</LogEventProperty>
- <LogEventProperty Name="Operating System" ID="Operating System">
- <![CDATA[ Windows
]]>
</LogEventProperty>
- <LogEventProperty Name="OS Version" ID="OS Version">
- <![CDATA[ XP
]]>
</LogEventProperty>
- <LogEventProperty Name="Processor" ID="Processor">
- <![CDATA[ Pentium
]]>
</LogEventProperty>
- <LogEventProperty Name="Display Resolution" ID="Display Resolution">
- <![CDATA[ 1024x768
]]>
。。。。。。
后面还有一长串
TestResults.txt文件如下:
Event Type Result Date & Time Computer Name
===================================================================================================
Computer Start Fail 1/8/2003 10:23:25 AM PHYLLISC11147
Script Start Fail 1/8/2003 10:23:25 AM PHYLLISC11147
Verification Point (Object Data) Pass 1/8/2003 10:23:28 AM PHYLLISC11147
Verification Point (Region Image) Fail 1/08/2003 10:24:00 AM PHYLLISC11147
Script End Fail 1/08/2003 10:24:00 AM PHYLLISC11147
Computer End Fail 1/08/2003 10:24:00 AM PHYLLISC11147