需要反序列的XML
- <?xml version='1.0' encoding='utf-8' ?>
- <GetCitiesListResponse>
- <Result Code='000000'>成功</Result>
- <CitiesList>
- <City PinYin='ZHANJIANG' HasOutService='N'>湛江</City>
- <City PinYin='zhangzhou' HasOutService='N'>漳州</City>
- </CitiesList>
- </GetCitiesListResponse>
复制代码 反序列化Model:
- [XmlRoot("GetCitiesListResponse")]
- public class GetCitiesListResponse
- {
- public Result Result { get; set; }
-
- [XmlArray("CitiesList"), XmlArrayItem("City")]
- public City[] CitiesList { get; set; }
- }
- public class Result
- {
- [XmlAttribute("Code")]
- public string Code { get; set; }
-
- [XmlText]
- public string Value { get; set; }
- }
-
- [XmlRoot("City")]
- public class City
- {
- [XmlAttribute("PinYin")]
- public string PinYin { get; set; }
-
- [XmlAttribute("HasOutService")]
- public string HasOutService { get; set; }
-
- [XmlText]
- public string Value { get; set; }
- }
复制代码
|
|