If your xml document will look like this (which is a valid xml document):
<?xml version='1.0' encoding='utf-8' ?>
<parameters>
<parameter>
<name>max_amount</name>
<label>Max Amount</label>
<unit>Millions</unit>
<component>
<type>Combo</type>
<attributes>
<type>Integer</type>
<displayed>4</displayed>
<selected>0</selected>
<items>
<item>5</item>
<item>10</item>
<item>20</item>
<item>50</item>
</items>
</attributes>
</component >
</parameter>
<parameter>
<name>max_amount_again</name>
<label>Max Amount_again</label>
<unit>Millions_again</unit>
<component>
<type>Combo</type>
<attributes>
<type>Integer</type>
<displayed>41</displayed>
<selected>01</selected>
<items>
<item>50</item>
<item>100</item>
<item>200</item>
<item>500</item>
</items>
</attributes>
</component >
</parameter>
</parameters>
You will need another class for storing all elements <parameter>...</parameter>
public class Parameters
{
[XmlElement("parameter")]
public List<Parameter> parameterList = new List<Parameter>();
}
And deserialize that document into that class.
XmlSerializer deserializer = new XmlSerializer(typeof(Parameters));
using (TextReader reader = new StreamReader(@"C:\path\to\your\xml"))
{
object obj = deserializer.Deserialize(reader);
Parameters deserialized = (Parameters)obj;
}
To access those parameter
elements you can simply use foreach loop e.g.:
Parameters p = new Parameters();
foreach (Parameter parameter in p.parameterList)
{
Console.WriteLine(parameter.Name);
}