Posted By

samilce on 03/06/13


Tagged

xml XElement XDocument


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

danfinrud55


create XElement from string


 / Published in: C#
 

Reading xml from file and create XElement from string

  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  

You need to login to post a comment.