I want to read some xml files.
when i am opening these files with notepad/wordpad/MS Word or any Browser, it is opening in its original form.But when i tried to execute
Sure sounds like a byte-order mark. Your question is unclear, but if actually do need to write these files from C# without a byte-order mark, you can specify this by passing false
to the UTF8Encoding
constructor:
XmlDocument xmlDoc = your_xml_document;
using (TextWriter writer = new StreamWriter(output_filename, new UTF8Encoding(false))
{
xmlDoc.Save(writer);
}
That might be the UTF-8 byte-order mark. Many text editors (for example Notepad++ and jEdit) allow you specify whether the BOM should be written for UTF-8 or not. With Windows Notepad your only option is to save the file as ANSI.