How to query an XML document in C# with some conditions

Aug 20 2012 1:41 PM
I have XML as given below:

<SIAINOTIFICATION>
<APPLICATIONNAME>ERP</APPLICATIONNAME>
<INTERFACENAME>Test-Interface</INTERFACENAME>
<LOCATION>Source</LOCATION>
<STATUSCONDITION>SUCCESS</STATUSCONDITION>
<INVOCATIONTYPE>ServiceInvoke</INVOCATIONTYPE>
<ROUTINGPARAM>123</ROUTINGPARAM>
</SIAINOTIFICATION>
<SIAINOTIFICATION>
<APPLICATIONNAME>ERP</APPLICATIONNAME>
<INTERFACENAME>Test-Interface</INTERFACENAME>
<LOCATION>Source</LOCATION>
<STATUSCONDITION>FAILURE</STATUSCONDITION>
<INVOCATIONTYPE>EMAIL</INVOCATIONTYPE>
<ROUTINGPARAM>123</ROUTINGPARAM>
</SIAINOTIFICATION>
<SIAINOTIFICATION>
<APPLICATIONNAME>ESS</APPLICATIONNAME>
<INTERFACENAME>Test-Interface</INTERFACENAME>
<LOCATION>Destination</LOCATION>
<STATUSCONDITION>SUCCESS</STATUSCONDITION>
<INVOCATIONTYPE>ServiceInvoke</INVOCATIONTYPE>
<ROUTINGPARAM>asd</ROUTINGPARAM>
</SIAINOTIFICATION>
<SIAINOTIFICATION>
<APPLICATIONNAME>ESS</APPLICATIONNAME>
<INTERFACENAME>Test-Interface</INTERFACENAME>
<LOCATION>Destination</LOCATION>
<STATUSCONDITION>FAILURE</STATUSCONDITION>
<INVOCATIONTYPE>ServiceInvoke</INVOCATIONTYPE>
<ROUTINGPARAM>asd</ROUTINGPARAM>
</SIAINOTIFICATION>

I have to query INVOCATIONTYPE from above XML based on LOCATION and STATUSCONDITION.

I.e.,
LOCATION = 'Source' and STATUSCONDITION = 'SUCCESS' what is INVOCATIONTYPE =?
LOCATION = 'Source' and STATUSCONDITION = 'FAILURE' what is INVOCATIONTYPE =?
LOCATION = 'Destination' and STATUSCONDITION = 'SUCCESS' what is INVOCATIONTYPE =?
LOCATION = 'Destination' and STATUSCONDITION = 'FAILURE' what is INVOCATIONTYPE =?

Any help would be highly appreciated!

Thanks

Answers (1)