C# , xml parsing. get data between tags

后端 未结 6 846
执念已碎
执念已碎 2021-01-21 16:24

I have a string :

responsestring = \"
SOmetext<         


        
6条回答
  •  太阳男子
    2021-01-21 17:08

    Get your xml well formed and escape the double quotes with backslash. Then apply the following code

     XDocument resp = XDocument.Parse("SOmetext");
    
           var r= from element in resp.Elements()
               where element.Name == "hash"
               select element;
    
    
        foreach (var item in r)
        {
            Console.WriteLine(item.Value);
        }
    

提交回复
热议问题