【发布时间】:2010-11-27 11:11:01
【问题描述】:
这更像是我想做的一个装饰性更改,我想知道如何使生成的 xml 文件使用 UTF-8 大写而不是 utf-8 小写?
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;
settings.Indent = true;
settings.IndentChars = "\t";
XmlWriter writeXML = XmlWriter.Create("test_file.xml", settings);
writeXML.WriteStartDocument(false);
writeXML.WriteComment(fileLicense);
writeXML.WriteStartElement("templates");
writeXML.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
writeXML.WriteAttributeString("xsi", "noNamespaceSchemaLocation", null, "test_file.xsd");
writeXML.WriteEndElement();
writeXML.WriteEndDocument();
writeXML.Close();
【问题讨论】:
标签: c# xml formatting