IT

//把String 转成XML
string resultString = "<querycategory><name>GiftShops</name><score>0.36622</score><name>Wine</name><score>0.14643</score><name>CoffeeampTea</name><score>0.09771</score></querycategory>";
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(resultString);
        XmlElement root = doc.DocumentElement;
        XmlNodeList list = doc.DocumentElement.ChildNodes;
        string j = ((XmlElement)list[0]).InnerText;
        string k = ((XmlElement)list[1]).InnerText;
        Response.Write(j);
        Response.Write(k);

//将XML转成String
string path=Server.MapPath(null)+@"\my_phone.xml";
   XmlDocument table=new XmlDocument();
   table.Load(path);
   XmlNode root=table.DocumentElement;
   StringBuilder str=new StringBuilder();
   str.Append(root.OuterXml);

posted on 2007-10-25 14:56  liufei  阅读(175)  评论(0编辑  收藏  举报