I need to parse an XML file with the following structure: EDITED
…
<?xml version="1.0" encoding="windows-1252" ?>
<TABLE>
<COMPO>
<alim_code> 1000 </alim_code>
<const_code> 56700 </const_code>
<teneur> 0 </teneur>
<min missing=" " />
<max missing=" " />
<code_confiance> D </code_confiance>
<source_code missing="." />
</COMPO>
<COMPO>
<alim_code> 1000 </alim_code>
<const_code> 60000 </const_code>
<teneur> 37,5 </teneur>
<min> 37,3 </min>
<max> 37,6 </max>
<code_confiance> D </code_confiance>
<source_code> 38 </source_code>
</COMPO>
</TABLE>
…
As you can see several fields are described differently when the value is known or missing. I have tried to use ReadXml() in a DataSet but it does not seems to work on "variable structure". Looks like the solution is probably to use Xdocument and LINQ but I am ignorant about LINQ and I did not succeed to write a working code.
I would appreciate if someone can show me possible code to parse and print (or even better add to a db) the content of this kind of XML file.