parse XML from string

前端 未结 2 1597
耶瑟儿~
耶瑟儿~ 2021-01-24 08:42

I have a xml string:

 Result : this is the result

How do i parse XML using XMLReader class to get \"this is the result

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-24 09:28

    var r = System.Xml.XmlReader.Create(new System.IO.StringReader(" Result : this is the result"))
    while (r.Read()) {
       if (r.NodeType == XmlNodeType.Element && r.LocalName == "Test") {
         Console.Write(r.ReadElementContentAsString());
       }
    }
    

提交回复
热议问题