如何将XML节点的内容保存到字符串?

我有和这样的XML:

 http://sofzh.miximages.com/c%23/example.jpg http://sofzh.miximages.com/c%23/example.jpg  http://sofzh.miximages.com/c%23/42566323.png   http://sofzh.miximages.com/c%23/example.jpg   

…我想提取并保存...作为字符串。

我的目标是获取提取元素的子文本节点。 例如http://sofzh.miximages.com/c%23/42566323.png

我试过了

 XmlNodeList xnList = xml.SelectNodes("image[@size='large']"); foreach (XmlNode xn in xnList) { ..... } 

……但我迷路了。

做我需要做的最好的方法是什么?

最好使用LINQ 2 XML:

假设您有以下xml文档:

  http://sofzh.miximages.com/c%23/example.jpg http://sofzh.miximages.com/c%23/example.jpg  http://sofzh.miximages.com/c%23/42566323.png   http://sofzh.miximages.com/c%23/example.jpg   

尝试这样的事情:

 var doc = XDocument.Parse(yourDocumentString); var largeImageUrl = doc.Root.Elements("image").Single(image => image.Attribute("size").Value == "large").Value;