标签:
//加载xml及反序列化
XmlDocument xdc = new XmlDocument(); xdc.Load(url); XmlSerializer ser = new XmlSerializer(typeof(InModel)); StringReader sr = new StringReader(xdc.InnerXml); InModeldocmodel = ser.Deserialize(sr) as InModel;
//对象序列化xml
OutModel outmodel = new OutModel(); XmlSerializer serializer = new XmlSerializer(typeof(OutModel )); MemoryStream ms = new MemoryStream(); serializer.Serialize(ms, outmodel ); return Content(System.Text.Encoding.UTF8.GetString(ms.ToArray()), "text/xml");
标签:
原文地址:http://www.cnblogs.com/lb12081116/p/4763203.html