假設 現在有一個string , 內面的內容是<abc><one> 1</one> <two>2</two></abc>我如何可以讀取string 里的 <two> 元素內的內容? 有人建議先把string 寫到xml file 中, 再用 XmlDocument  來讀取
這個方法很笨
請各位大大幫忙

解决方案 »

  1.   

                string _Value = "<abc> <one> 1 </one> <two>2 </two> </abc>";            XmlDocument _Document = new XmlDocument();
                _Document.LoadXml(_Value);            MessageBox.Show(_Document.SelectNodes("abc/two")[0].InnerText);XmlDocument 的LoadXML的方法
      

  2.   

    XmlDocument doc = XmlDocument.Parse(string)