今天中午收到老美的题目,限定在二十四小时内解决,请大伙帮忙啦
题目是
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

解决方案 »

  1.   

    哦,这个我知道,
    XML你学过吗?学过就知道他是要你实现一个函数:读去XML文件,把它转换成我们便于阅读的格式
      

  2.   

    老弟,你有qq或msn吗,请教了
      

  3.   

    这个实现函数我没写过,知道点思路
    XML 它就是一个单根,然后一级一级往下添加目录的,你要把它读出来就要自己解析它的结构了
      

  4.   

    如果您现在还没有学过XML,
    估计够呛。
      

  5.   

    XML文件解析的通用库应该有吧,用不着自己从基本的开始写
      

  6.   

    老大们,写代码肯定是来不及了,只要一个思路向boss汇报就可以交差了,不知道老大们对xml熟悉吗
      

  7.   

    人家要的是思路,又没要代码,主要描述应该在解析xml文件的方法上,先分析出他的xml文件框架格式,然后针对该格式设计专门的解析函数。
      

  8.   

    把<>以外的东西删掉先,格式不就出来了,再不然把*.txt改称*.xml,那个专门的xml工具看一眼也行啊
      

  9.   

    VC 知识库上有个 XML_PARSER.cpp 的类,你试试?