blah blah blah is here! blah blah » Close

up1down
link

I am using WebClient to download simple xml files from a server. During the process it's stripping out the carriage returns from the file. It doesn't affect the usability but it does affect the readability. Can I force it to treat the download as binary (or stop it from removing CR's from an ASCII transmission)?

last answered one year ago

1 answers

link

I doubt whether you can do either of those things.

However, what I'd do is to reformat the file after it's been downloaded. If you load the file into an XmlDocument and then immediately resave it, it should be auto-indented by default:

using System.Xml;

//...

XmlDocument doc = new XmlDocument();
doc.Load("eeboy.xml");
doc.Save("eeboy.xml");

Feedback