我想创建具有以下结构的 xml 文档
<ServerFp Command="Cashed">
<Cashed Value="199.99"/>
</ServerFp>
所以我尝试这样:
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
using (var writer = XmlWriter.Create(filename, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("ServerFp");
writer.WriteAttributeString("Command", "Cashed");
}
到目前为止这很好吗?如何结束这个文件?带节点<Cashed Value="199.99"/>