Relative complicated linq query

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
First of all guys i would like to precise that Im new to LinQ and i wasnt able to find the answer my self.
here is the problem, i have an XML file (which is very big i simplified it as much as possible) i need to select
<span class="" id="x_result_box" lang="en <span class="x_hps only <span class="x_hps
the successive Blocks <span class="x_hps which <span class="x_hps
verifies a certain <span class="x_hps condition.
The XML looks like :
<pre class="prettyprint <MaLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MaLogFile.xsd
<Message MsgType="Info" MsgText="Association Established With Machine 3
<TimeStamp Date="2012-04-23" Time="08:26:01.797" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Open Association with machine 3, ok
<TimeStamp Date="2012-04-23" Time="08:26:01.797" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Open File 66.2216774846.15610081128145128.11
<TimeStamp Date="2012-04-23" Time="08:26:01.797" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="DestID=91370
<TimeStamp Date="2012-04-23" Time="08:26:01.828" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Message Opened for Service
<TimeStamp Date="2012-04-23" Time="08:26:01.849" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Send Order: CustomOrder1/14233
<TimeStamp Date="2012-04-23" Time="08:26:01.850" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Send order Description: diagnostique
<TimeStamp Date="2012-04-23" Time="08:26:01.850" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Send Child Order Description: diagnostique
<TimeStamp Date="2012-04-23" Time="08:26:01.850" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Send Instance Number: 1
<TimeStamp Date="2012-04-23" Time="08:26:01.850" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Affected UID set to 66.2216774846.15610081128145128.11
<TimeStamp Date="2012-04-23" Time="08:26:01.851" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Message Send
<TimeStamp Date="2012-04-23" Time="08:26:01.993" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Response Received
<TimeStamp Date="2012-04-23" Time="08:26:02.404" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Process, Set pixels, Process, Send, Read response,
<TimeStamp Date="2012-04-23" Time="08:26:02.404" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Association with Machine 3 Closed
<TimeStamp Date="2012-04-23" Time="08:26:02.413" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Close Association with Machine 3, ok
<TimeStamp Date="2012-04-23" Time="08:26:02.413" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
<Message MsgType="Info" MsgText="Order Push completed, All OK
<TimeStamp Date="2012-04-23" Time="08:26:02.414" TimeBias="-60"/>
<ProcessID>2460</ProcessID>
<ThreadName>4484</ThreadName>
<AppName>App1</AppName>
<ComputerName>XPS001</ComputerName>
</Message>
</MaLog>[/code]
What i want to have :
1. Select only App1 : other applications are not targeted by this program<br/>

<pre class="prettyprint <AppName>App1</AppName>[/code]
And message type is "Info"
<pre class="prettyprint MsgType="Info"[/code]
2. The occurrence of all latency, a latency is when the difference between two successive Time ="hour.Min.Sec.ms" values (two blocks) is more than 10 seconds
3. This must be grouped by Machine, notice that in the xml file we can find more than association with a specific machine the beginning and the end of an association is marked with :<br/>

<pre class="prettyprint Association Established With Machine 3[/code]
<pre class="prettyprint Association with Machine 3 Closed[/code]
The 2. is the heart of this Linq query and was the most difficult part for me as i couldnt find a way to do it special when i need to go higher when a latency is detected to get the machine.
So basically this is it, go through the xml whenever a two successive messages are separated by more than 10 seconds go back find the machine ...etc those info will be stored in my collection.
Thanks a lot for your help.


<br/>

<br/>

<br/>

<br/>

<span class="" id="x_result_box" lang="en <span class="x_hps <br/>
<br/>

<br/>


View the full article
 
Back
Top