Hi all.
I can't understand the problem with my code...
I wrote a simple test function to write an XML document and in the
resulting file I find 3 strange chars before the document starting.
=== CODE ===
using( XmlTextWriter w = new
XmlTextWriter("test2.xml",System.Text.Encoding.UTF 8) )
{
w.Namespaces = false;
w.Indentation = 4;
w.Formatting = Formatting.Indented;
w.WriteStartDocument();
w.WriteStartElement("root");
w.WriteStartElement("item");
w.WriteAttributeString("attr","123");
w.WriteEndElement();
w.WriteEndElement();
w.WriteEndDocument();
w.Close();
}
===
And the result I get is:
===
<?xml version="1.0" encoding="utf-8"?>
<root>
<item attr="123" />
</root>
===
Help me please!