2

I have xml file and I need to convert the text that I get from it:

I just start to write code, but I don't know how to realize this:

string text = File.ReadAllText(path);             

XDocument documentcode = XDocument.Load(text);
revolutionkpi
  • 2,632
  • 10
  • 45
  • 84

1 Answers1

4

You will have to specify the correct encoding when reading:

 string text = File.ReadAllText(path, Encoding.GetEncoding("windows-1251"));
 XDocument documentcode = XDocument.Parse(text);  // not load. 

You probably don't have to do anything special when writing.

H H
  • 263,252
  • 30
  • 330
  • 514