从XML文件中删除版本 [英] Removing version from xml file
本文介绍了从XML文件中删除版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用创建状格式的XML 的XmlWriter
。但在输出有版本信息也是
I am creating a Xml like format using XmlWriter
. But in the output there is version information also.
<?xml version="1.0" encoding="utf-8"?>
我不需要这在我的文件中。我该怎么办呢?有什么办法通过代码来去除呢?
I don't need this in my file. How can I do that? Is there any way to remove it by code?
推荐答案
使用 ConformanceLevel
和 OmitXmlDeclaration
属性。例如:
XmlWriter w;
w.Settings = new XmlWriterSettings();
w.Settings.ConformanceLevel = ConformanceLevel.Fragment;
w.Settings.OmitXmlDeclaration = true;
这篇关于从XML文件中删除版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文