c# File in xml format not opening in xml viewer



Created a .xml file in C# console program using StreamWriter without using any xml write library functions). However, it does not show data in XML viewer - shows fine if opened as a text file. I tried, like I say somewhere on this site, the following -



FileStream fStream = new FileStream (@"c:\new.xml", FileMode.Create)

StreamWriter fWrite = new StreamWriter(fStream, Encoding.UTF8);

fwrite.WriteLine (myLine);


where the first myLine was


Is there a way to make this open like an xml file without having to use the xml lib functions?


No comments:

Post a Comment