You can use the standard XmlSerializer
if you're willing to make a few modifications to your class:
- XML is case-sensitive so you should use lower-case names for your properties (
id
,name
, etc. - create a containing class with an array of your data class
- Add the attribute
[XmlRoot("markers")]
to the containing class - Add the attribute
[XmlElement("marker")]
to the array property
Something like this:
[XmlRoot("markers")]
public class EventList
{
[XmlElement("marker")]
public List<EventClass> EventClasses {get; set;}
}
public class EventClass
{
public int id {get; set;}
public string name {get; set;}
public string address {get; set;}
public string type {get; set;}
}