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");
  3.  
  4. // create xelement from string
  5. XElement e = XDocument.Parse(s_xml).Root;
  6.  
  7. //then take value of a field you need
  8. string HeaderVersion = e.Element("HeaderVersion").Value;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.