I have XML file with the following structure:
<rule ID="16" Attribute="Savvy" Parametr="">
<body>
<term Operation="AND">
<IF_ID>8</IF_ID>
<Ratio>=</Ratio>
<IF_Value>impossible</IF_Value>
</term>
<term Operation="OR">
<IF_ID>9</IF_ID>
<Ratio>=</Ratio>
<IF_Value>yes</IF_Value>
</term>
<term Operation="AND">
<IF_ID>8</IF_ID>
<Ratio>!=</Ratio>
<IF_Value>impossible</IF_Value>
</term>
<term>
<IF_ID>9</IF_ID>
<Ratio>=</Ratio>
<IF_Value>no</IF_Value>
</term>
</body>
<value>normal savvy</value>
</rule>
I need to add it to Listbox and get 1 row:
8 = impossible AND 9 = yes OR 8 != impossible AND 9 = no - normal savvy
If you need to know how to read an attribute via XDocument it is as simple as doing
xElement.Attribute("Operation")Now to actually get the string structure you want it all you need to do is loop through your terms and append them to a string.
This assumes that you will have a value for each element and there is only one
<rule/>. Null checks would be needed to make it correct for each element.Now how this relates to a listbox I am not sure and might require a bit more detail?
???