utf-8 是大写吗?
这更多是我想要做的装饰性更改,我想知道如何使用 UTF-8 大写而不是 utf-8 小写生成生成的 xml 文件?
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();
This is more of a cosmetic change that I wanted to make and I was wondering how could I make the generated xml file with UTF-8 uppercase instead of utf-8 lowercase ?
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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了这篇博文。看来这就是你想要的。
要使用此自定义编码,您需要使用 XMLTextWriter 作为 XDocument Save 方法的目标。
I found this blog post. Seems it is what you want.
To use this custom encoding you need to use an XMLTextWriter as the destination to the XDocument Save method.