先是读取文件TestLog.txt的内容到字符串$str中, 建立$str的dom对象,在通过DOMXPath函数查询你要的内容就可以了.DOMXPath是通过xpath来查询的,查询的xpath字符串分别是: Event Type : "TestLog/LogEvent" Result : "TestLog/LogEventProperty[Name=\"Result\"]" Date : "TestLog/LogEventProperty[Name=\"Start Date\"]" Time : "TestLog/LogEventProperty[Name=\"Start Time\"]" Computer Name : "TestLog/LogEventProperty[Name=\"???????????\"]"然后再把得到的结果按照如下格式输出到文本文件TestResults.txt中就可以了: Event Type Result Date & Time Computer Name具体的看手册吧.
Event Type : "TestLog/LogEvent"
Result : "TestLog/LogEventProperty[Name=\"Result\"]"
Date : "TestLog/LogEventProperty[Name=\"Start Date\"]"
Time : "TestLog/LogEventProperty[Name=\"Start Time\"]"
Computer Name : "TestLog/LogEventProperty[Name=\"???????????\"]"然后再把得到的结果按照如下格式输出到文本文件TestResults.txt中就可以了:
Event Type Result Date & Time Computer Name具体的看手册吧.