问题描述
我是使用xmlwriter创建xml文件的,我认为它可以正常工作,但是当我尝试验证它失败时,bcoz出现如下图所示的spl字符(BOM),就在论坛上消失了,很多人都在劝我使用"SecurityElement .逃脱".不确定如何以及在哪里.有人请引导我从xml文件中删除此spl charecter.
ÿ
如果找到上述符号的代码
看起来像是‘û¿<`
我的代码
Am creating an xml file using xmlwriter,i thought it works fine but when i try to validate it fails bcoz there is spl character (BOM) appears like below,just gone thru forum seen lot of people adive me to use "SecurityElement.Escape". Am not sure how and where.Some one please guide me to remove this spl charecter from the xml file.

if found the code for the above symbol
It look like `<`
My Code
XmlWriter xmlWrite;
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
xmlWrite = XmlWriter.Create(@"c:\test.xml",settings);
xmlWrite.WriteStartElement("metadata");
xmlWrite.WriteElementString("story", story);
xmlWrite.Close();
我可以成功删除版本,但仍然有spl字符.现在卡住了.
有帮助吗?
i can succesfully remove the version but still the spl characters are there . Am stuck now.
Any help ?
推荐答案
XmlWriter xmlWrite;
XmlWriterSettings settings = new XmlWriterSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.OmitXmlDeclaration = true;
这篇关于如何替换或删除XML中的SPL字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!