A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© sunrise2 高级黑马   /  2014-7-22 22:37  /  753 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

需要反序列的XML
  1. <?xml version='1.0' encoding='utf-8' ?>
  2. <GetCitiesListResponse>
  3.     <Result Code='000000'>成功</Result>
  4.     <CitiesList>  
  5.         <City PinYin='ZHANJIANG' HasOutService='N'>湛江</City>
  6.         <City PinYin='zhangzhou' HasOutService='N'>漳州</City>
  7.     </CitiesList>
  8. </GetCitiesListResponse>
复制代码
反序列化Model:
  1. [XmlRoot("GetCitiesListResponse")]
  2.    public class GetCitiesListResponse
  3.    {
  4.        public Result Result { get; set; }

  5.        [XmlArray("CitiesList"), XmlArrayItem("City")]
  6.        public City[] CitiesList { get; set; }
  7.    }
  8.    public class Result
  9.    {
  10.        [XmlAttribute("Code")]
  11.        public string Code { get; set; }

  12.        [XmlText]
  13.        public string Value { get; set; }
  14.    }

  15.    [XmlRoot("City")]
  16.    public class City
  17.    {
  18.        [XmlAttribute("PinYin")]
  19.        public string PinYin { get; set; }

  20.        [XmlAttribute("HasOutService")]
  21.        public string HasOutService { get; set; }

  22.        [XmlText]
  23.        public string Value { get; set; }
  24.    }
复制代码

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马