How do we read an attribute of an XML array element? The below code I use to read an attribute of an XML array element which is not working. please let me know an alternate solution to read if avaliable or what i was missing. I saw a lot of samples but unable to identify what i was missing.
Source xml to read is
<RootElement>
<devices AttNAme="attValue">
<device>
<sometag/>
<device>
<device>
<sometag/>
<device>
</devices>
<RootElement>
The Code i use is
[XmlRoot("RootElement")]
public class RootElement
{
[XmlArrayItem("DeviceType", typeof(DeviceTypeSection))]
[XmlArray("devices")]
public DeviceTypesSection DeviceTypesInfo { get; set; }
}
[XmlType("DeviceTypes")]
public class DeviceTypesSection : List<DeviceTypeSection>
{
[XmlAttribute("AttNAme")]
public string AttNAme{ get; set; }
}
..and so on
Thanks,