.log文件中的XML

时间:2014-09-12 12:30:21

标签: xml logging xml-parsing

我的.log文件在我的服务器上每15分钟更新一次,与某些移动设备进行通信。

一些信息是文本和一些xml。

如何提取xml,我已经尝试过excel但是返回错误,尝试过解析也会返回错误。

对于每15分钟返回一次的单位,返回的数据看起来与此类似,因此在一天结束时有相当多的混合文本和xml。

2014\09\12 00:00:49.063 | Broadcast
2014\09\12 00:00:49.064 | ClientCount: 1
2014\09\12 00:00:49.064 | ClientID: 0
2014\09\12 00:00:49.065 | ClientName: UK1  ClientType: 6
2014\09\12 00:00:49.065 | nID: 3
2014\09\12 00:00:49.065 | Client Exists
2014\09\12 00:00:49.066 | Client Connected
2014\09\12 00:00:49.066 | CUCMID set
2014\09\12 00:00:49.072 | 
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus><Responses><Response><Header><SendRepeat>0</SendRepeat><Timestamp>12.09.2014 00:00:49</Timestamp><OrgaNo>00000</OrgaNo><Transmitter>+447000000000</Transmitter><SourceNo>0000000000000000</SourceNo><TaskType>HST</TaskType><DemandTask>0</DemandTask><CommunicationSystem>T1</CommunicationSystem><CucmID>5</CucmID></Header><Data><HST><SourceTyp>3</SourceTyp><CarID>0</CarID><Timestamp>12.09.2014 00:01:00</Timestamp><TripState>0</TripState><Km>0</Km><Mileage>33</Mileage><DoorBC>0</DoorBC><DoorCar>-1</DoorCar><Ignition>0</Ignition><DataKeyIn>1</DataKeyIn><FuelCardIn>-1</FuelCardIn><BatteryOK>1</BatteryOK><Temperature>-1</Temperature><Registration>1</Registration><SignalQuality>31</SignalQuality><SignalError>99</SignalError><GPRSRegistration>1</GPRSRegistration><ConnectState>2</ConnectState><TrackingMode>-1</TrackingMode><OBDMode>-1</OBDMode><SourceNo>01B758????000003</SourceNo><ReaderState>7143521</ReaderState><SIMID>+447000000000</SIMID><Firmware></Firmware><LEDStatus><Cmd>255</Cmd><State>255</State><Red>1</Red><Yellow>0</Yellow><Green>0</Green><Reason>255</Reason><Info>255</Info></LEDStatus><Battery><Level>1150</Level><Value>1240</Value></Battery><FuelLevel><PerCent>92</PerCent><Total>65535</Total></FuelLevel></HST></Data></Response></Responses></ResponseStatus>
ÿ

任何想法都会很棒

[R

1 个答案:

答案 0 :(得分:0)