Return to Snippet

Revision: 62678
at March 6, 2013 00:30 by samilce


Updated Code
// read xml document from file to a string
string s_xml = System.IO.File.ReadAllText("deneme.xml");

// create xelement from string 
XElement e = XDocument.Parse(s_xml).Root;

//then take value of a field you need
string HeaderVersion = e.Element("HeaderVersion").Value;

Revision: 62677
at March 6, 2013 00:11 by samilce


Initial Code
// read xml document from file to a string
string s_xml = System.IO.File.ReadAllText("deneme.xml");

// create xelement from string 
XElement e = XDocument.Parse(s_xml).Root;

//then take value of a field you need
string HeaderVersion = e.Element("HeaderVersion").Value;

//how to take elements having same name
e.Elements("Items");

Initial URL


Initial Description
Reading xml from file and create XElement from string

Initial Title
create XElement from string

Initial Tags
xml

Initial Language
C#