create XElement from string

/ Published in: C#
Save to your folder(s)

Reading xml from file and create XElement from string

Copy this code and paste it in your HTML
  1. // read xml document from file to a string
  2. string s_xml = System.IO.File.ReadAllText("deneme.xml");
  4. // create xelement from string
  5. XElement e = XDocument.Parse(s_xml).Root;
  7. //then take value of a field you need
  8. string HeaderVersion = e.Element("HeaderVersion").Value;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.