using (TextWriter tw = new StreamWriter(fileName))
{
XmlTextWriter w = new XmlTextWriter(tw);
w.Formatting = Formatting.Indented;
w.WriteStartElement("Root");
w.WriteStartElement("Child01");
w.WriteAttributeString("attr01", "blabla");
w.WriteString("blablabla");
w.WriteEndElement(); // Child01
w.WriteEndElement(); // Root
}
tbd…