XDocument xdoc = new XDocument(
new XDeclaration("1.0", null, null),
new XElement(bla));
using (var writer = new XmlTextWriter(@"folderpath\index.xml", new UTF8Encoding(false)))
{
//writer.Formatting = Formatting.Indented;
xdoc.Save(writer);
}
I have to generate an XML document which matches exactly my sample. This code however produces:
<?xml version="1.0" encoding="utf-8"?>
but it should look like this:
<?xml version="1.0"?>
How can I solve this either with XMLTextWriter
or linq?