I want to create xml document with following structure
<ServerFp Command="Cashed">
<Cashed Value="199.99"/>
</ServerFp>
So I tried like this :
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (var writer = XmlWriter.Create(filename, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("ServerFp");
writer.WriteAttributeString("Command", "Cashed");
}
Is this good so far and how to end this file? with node <Cashed Value="199.99"/>
XmlWriter, to be honest - any reason you don't want to use LINQ to XML, which would make this trivial?