标签:
xmldocument
1 XmlDocument result = new XmlDocument(); 2 3 //root 4 XmlElement root = result.CreateElement("root"); 5 result.AppendChild(root); 6 7 8 StampService mrs = new StampService(); 9 IQueryable<BI_StampInfo> carres = mrs.GetAllBases(); 10 if (carres != null) 11 { 12 List<BI_StampInfo> carlist = carres.ToList(); 13 foreach (BI_StampInfo item in carlist) 14 { 15 //info 16 XmlElement info = result.CreateElement("info"); 17 root.AppendChild(info); 18 19 //elements 20 XmlElement Type1 = result.CreateElement("类别"); 21 Type1.InnerText = item.Type; 22 Type1.SetAttribute("newAttribute", "test"); 23 info.AppendChild(Type1); 24 25 26 } 27 } 28 29 return result;
标签:
原文地址:http://www.cnblogs.com/King-JJ/p/4914947.html