I have the following XML part which schema I can't change. NUMBER, REGION, MENTION, FEDERAL are columns:
<COLUMNS LIST="20" PAGE="1" INDEX="reg_id">
<NUMBER WIDTH="3"/>
<REGION WIDTH="60"/>
<MENTION WIDTH="7"/>
<FEDERAL WIDTH="30"/>
</COLUMNS>
I want to deserialize it to public List<Column> Columns {get;set;}
property. So element name would go to Column.Name. Column class:
public class Column
{
//Name goes from Element Name
public string Name {get;set;}
[XmlAttribute("WIDTH")]
public int Width {get;set;}
}
Is it possible with XmlSerializer class?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…