日期:2014-05-17  浏览次数:21199 次

如何将xml格式的字符串保存成xml文件
我有一个字符串 string info="<?xml version="1.0" encoding="UTF-8" ?>
 <hasp_info>
   <hasp id="1923425005" type="HASP-Hr">
     <feature id="0" />
     <feature id="1" />
   </hasp>
 </hasp_info>";想问下怎么能够保存成XMLFile1.xml这样的一个实体文件里去。在线等,急。有结果了就给分
XML String 编码 UTF-8

------解决方案--------------------
string info=@"<?xml version=""1.0"" encoding=""UTF-8"" ?>
 <hasp_info>
   <hasp id=""1923425005"" type=""HASP-Hr"">
     <feature id=""0"" />
     <feature id=""1"" />
   </hasp>
 </hasp_info>";
                 XmlDocument xdoc = new XmlDocument();
                 xdoc.LoadXml(info);
                 xdoc.Save( @"C:\Users\myx\Desktop\login.xml");