XML 中的特殊字符

如何处理cnnvd漏洞库xml文档中的特殊字符 提示:本章只介绍了处理漏洞库xml文档的特殊字符,下篇文章将漏洞库xml文档转成csv格式的小工具。 阅读详情

XML中的特殊字符
(个人用于记录,只是为解决一时的问题)

1. Message         "An error occurredwhile parsing EntityName. Line 1, position 527."         string
//z 2011-12-29 9:54 AM is2120@csdn
事情的起源:
在传入xml文件给XmlDocument的时候总是出现Exception(异常)
//z 2011-12-29 9:54 AM is2120@csdn
-                              $exception         {"An error occurred while parsingEntityName. Line 1, position 527."}      System.Exception{System.Xml.XmlException}

-                              [System.Xml.XmlException]        {"An error occurred while parsingEntityName. Line 1, position 527."}                System.Xml.XmlException

-                              base      {"An error occurred while parsingEntityName. Line 1, position 527."}      System.SystemException{System.Xml.XmlException}

-                              base      {"An error occurred while parsingEntityName. Line 1, position 527."}      System.Exception{System.Xml.XmlException}

                                _className        Cannot fetch the value of field'_className' because information about the containing class is unavailable.    string

                                _data   Cannot fetch the value of field '_data'because information about the containing class is unavailable.                System.Collections.IDictionary

                                _dynamicMethods          Cannot fetch the value of field'_dynamicMethods' because information about the containing class isunavailable.   object

                                _exceptionMethod        Cannot fetch the value of field'_exceptionMethod' because information about the containing class isunavailable.   System.Reflection.MethodBase

                                _exceptionMethodString             Cannot fetch the value of field'_exceptionMethodString' because information about the containing class isunavailable.     string

                                _helpURL            Cannot fetch the value of field'_helpURL' because information about the containing class is unavailable.        string

                                _HResult              Cannot fetch the value of field'_HResult' because information about the containing class is unavailable.        int

                                _innerException               Cannot fetch the value of field'_innerException' because information about the containing class isunavailable.   System.Exception

                                _message           Cannot fetch the value of field'_message' because information about the containing class is unavailable.    string

                                _remoteStackIndex        Cannot fetch the value of field'_remoteStackIndex' because information about the containing class isunavailable.   int

                                _remoteStackTraceString             Cannot fetch the value of field'_remoteStackTraceString' because information about the containing class isunavailable.     string

                                _source                Cannot fetch the value of field'_source' because information about the containing class is unavailable.        string

                                _stackTrace        Cannot fetch the value of field'_stackTrace' because information about the containing class is unavailable.    object

                                _stackTraceString            Cannot fetch the value of field'_stackTraceString' because information about the containing class isunavailable.   string

                                _xcode Cannot fetch the value of field '_xcode'because information about the containing class is unavailable.        int

                                _xptrs   Cannot fetch the value of field '_xptrs'because information about the containing class is unavailable.        System.IntPtr

+                             Data       {System.Collections.ListDictionaryInternal}          System.Collections.IDictionary{System.Collections.ListDictionaryInternal}
//z 2011-12-29 9:54 AM is2120@csdn
2. 解决方案
2.1 xml中的特殊字符有5种:

<

小于号

>

大于号

&

&

'

'

单引号

"

"

双引号

在xml文件中将相应的特殊(转义)字符替换掉即可
//z 2011-12-29 9:54 AM is2120@csdn
2.2 但是可以不用自己造车轮的
微软提供了
SecurityElement.Escape
tagText = SecurityElement.Escape(tagText);


2.3 XmlTextWriter Class 在内部对此也做了相应的处理

//z 2011-12-29 9:54 AM is2120@csdn
2.4 含有特殊字符的也可以放在CDATA中进行处理(视情况而定)
100个Python实战项目(七)实现摩斯密码翻译器 作者主页:海拥 作者简介:CSDN全栈领域优质创作者、HDZ核心组成员、蝉联C站周榜前十 粉丝福利:往期获奖记录 每周送6~9本书,不定期送各种小礼品(搪瓷杯、抱枕、鼠标垫、马克杯等) 摩斯密码是一种将文本信息作为一系列通断的音调、灯光或咔嗒声传输的方法,无需特殊设备,熟记的小伙伴即可直接翻译。它以电报发明者Samuel F. B. Morse的名字命名。 算法 算法非常简单。英语中的每个字符都被一系列“点”和“破折号”代替,或者有时只是单数的“点”或“ 阅读详情

相关推荐

安装并新建windows下wxwroks7.0 bootrom工程

安装licence,将zwrsLicense-vx7-perm.lic粘贴到安装目录C盘WindRiver/license下。现在双击Workbench 4,新建vxworks7.0工程,会出现下面的情况,因为没有licence。编译完成binaries下生成wxwroks x86格式,可以修改bootrom硬件信息的配置了。单击x86_wxwroks工程右键,build project编译工程。双击桌面Workbench 4打开,新建windows下工程。新建完成,选择finish。

wangjie36的博客 1901

VS2008查看WinForm界面遇到的问题

<br />使用VS2008打开SFSC的源代码Solution时,打开工程里的界面,报“An error occurred while parsing EntityName. Line 2, position 48. ”的错误。<br />An error occurred while parsing EntityName. Line 2, position 48. <br />Hide     <br />at System.Xml.XmlTextReaderImpl.Throw(Exception e

Henry Lu 1929

合并财务报表模板--带数据 2023-5-26 135253 10.xls

合并财务报表模板--带数据 2023-5-26 135253 10.xls

CSS选择器总结

1、元素选择器(不区分大小写) &amp;lt;p&amp;gt;Hello World!&amp;lt;/p&amp;gt; /*All p elements are red*/ p{ color:red; } 2、类选择器 &amp;lt;ul&amp;gt; &amp;lt;li class=&quot;first done&quot;&amp;gt;Create an HTML document&

Jane_96的博客 518

sqlserver char(1)类型字段查询出现‘‘报错 解决办法An error occurred while converting the char value to JDBC data typ

An error occurred while converting the char value to JDBC data type INTEGER.

weixin_42164754的博客 1498

博客处女作:使用VS2008时的一个小小注意点。

[VS2008][实践经验总结]       今天我打开某一个C#项目后,试图打开窗口和UserControl设计器时,VS并没有呈现出你原先做好的设计界面,而是给出了如下的错误提示:To prevent possible data loss before loading the designer, the following errors must be resolved  

tangjichuan的专栏 1712

URL 或 XML 文档中的特殊字符

<! v/:* {behavior:url(#default#VML);}o/:* {behavior:url(#default#VML);}w/:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);}--> Normal 0 false fal

Mobidogs Blog 2066

xml中的特殊字符

xml中存在5个特殊字符,某些情况下使用这些字符可能会产生错误,例如: <user>s<s</user> 这时应该使用该字符对应的转义字符: 特殊字符 转义字符 & &amp; < &lt; > &gt; " &quot; ’ &apos; 注:“>”可以直接使用。 ...

s_tupid的博客 3256

XML中的特殊字符

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33938733的博客 197

xml中的特殊字符如换行

换行 (&#x000A;) 空格 (&#x0020;) Tab (&#x0009;) 回车 (&#x000D;)

weixin_42139945的博客 1390

XML中的CDATA且mybatis中特殊字符转义

XML中的CDATA即mybatis中特殊字符转义

Sueko的博客 1726

android strings.xml 特殊字符,android strings.xml 中的特殊字符转义

XML转义字符以下为XML标志符的数字和字符串转义符" (" 或 ")' (' 或 ')& (& 或 &)lt(gt(>) (> 或 >)下面的字符在 [XML]中被定义为 空白(whitespace)字符:空格 ( )Tab ( )回车 ( )换行 ( )KeyEvent.KEYCODE_0 | ('\uff09' <&lt...

weixin_34632164的博客 553

Mybatis中的sql语句yml文件,xml文件 遇到的特殊字符处理

Mybatis中的sql语句中的“<”浩和“>”号要用转义字符“&lt;”和”&gt;“,否则会报错! 问题一、 使用的数据库密码中带有特殊字符* 在密码前后加单引号,如下图: 不加单引号,部署时会提示配置文件内容有错误。 问题二、 xml 数据库秘密有&字符 原密码387xhwXMQ&UNkyZ3 387xhwXMQ&am...

Osborn的博客 1471
上一篇: Google SSL zz
下一篇: Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
is2120
博客等级 码龄16年 60粉丝 464原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值