I got an XML file with this kind of structure:
<?xml version="1.0"?>
<root>
<first_element>
<some_info></some_info>
<other_info></other_info>
</first_element>
<second_element prop1="bla bla" prop2="bla bla" prop3="bla bla" ... prop50="bla bla">01</second_element>
<second_element prop10="bla bla" prop11="bla bla" prop12="bla bla" ... prop50="bla bla">02</second_element>
<second_element prop1="bla bla" prop2="bla bla" prop3="bla bla" ... prop60="bla bla">03</second_element>
</root>
I would like to deserialize the entire "second_element" content into a POCO class:
public class SecondElement
{
[XmlText]
public string ElementText { get; set; }
//The Attribute list
public List<AttributeObject> {get; set; }
}
public class AttributeObject
{
public string Name {get ; set;} //Attribute Name
public string Value {get ; set;} //Attribute Value
}
I could have multiple attributes, until a maximum of 100, but the total items list is inconstant: sometimes attributes are missing, sometimes the list starts from the 10th element and so on.
Is there a way to achieve this whole content through deserialization? Thank you.