Hi
I have xml containing :
<day p="d">
<day p="n">
What attributes do I need to add to Day class in order to deserialize the xml with XmlSerializer?
Hi
I have xml containing :
<day p="d">
<day p="n">
What attributes do I need to add to Day class in order to deserialize the xml with XmlSerializer?
[XmlElement("day")]
public class Day
{
[XmlAttribute("p")]
public string P {get;set;}
}
The following decorations -
[XmlType(TypeName="day")]
public class Day
{
[XmlAttribute("p")]
public string P { get; set; }
}
[XmlRoot("someObject")]
public class SomeObject
{
[XmlArray("days")]
public List<Day> Days { get; set; }
}
Would serialise to:
<someObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<days>
<day p="n" />
<day p="p" />
</days>
</someObject>
Hope that gets you somewhere.
Kev