How to read XML file into string?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have XML files stored on C: which im trying to read as string. I used the following code, but it does not read the XML declaration
<pre>XDocument doc = new XDocument("C:MyXML.xml");
string xml = doc.ToString();[/code]
I want the fast possible way which can read XML from file with XML declaration and ommiting white spaces if any

View the full article
 
Back
Top