Read a XML (from a string) and get some fields - Problems reading XML

前端 未结 5 1361
青春惊慌失措
青春惊慌失措 2020-12-04 12:09

I have this XML (stored in a C# string called myXML)




        
5条回答
  •  不思量自难忘°
    2020-12-04 12:20

    I used the System.Xml.Linq.XElement for the purpose. Just check code below for reading the value of first child node of the xml(not the root node).

            string textXml = "value of first child........";
            XElement xmlroot = XElement.Parse(textXml);
            string firstNodeContent = ((System.Xml.Linq.XElement)(xmlroot.FirstNode)).Value;
    

提交回复
热议问题