读取xml字符串

 string strXml = @"<MessageData><pm_id>10</pm_id><pm_title>这是公司或者产品的名称</pm_title><pm_tel>this is telphone</pm_tel><pm_content>这是留⾔言内容</pm_content><pm_link>这是姓名</pm_link><pm_province>河南</pm_province><pm_city>郑州市</pm_city><pm_type>0</pm_type><cid>20</cid></MessageData>";
            XmlDocument xd = new XmlDocument();
            xd.LoadXml(strXml.Trim());
            XmlNode xnRoot = xd.SelectSingleNode("MessageData");
            if (xnRoot != null)
            {
                Console.Write("pm_id="+ xnRoot.ChildNodes[0].InnerText.ToString());
               
            }

你可能感兴趣的:(读取xml)