在c#中读取xml问题 [英] reading xml issue in c#
本文介绍了在c#中读取xml问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
i我正在读取一个xml文件我粘贴了它的一部分
< 命令 > CHECK < / Command >
< ECUSignalName > < / ECUSignalName >
< ECUSignalValue > KeyPosition1 == KeyPosition1&& Sleep_flag2 == Sleep_flag2&& < / ECUSignalValue > 温泉n>
< ECUSignalComment > < / ECUSignalComment >
但是当它看到这个
行
KeyPosition1 == KeyPosition1&&& Sleep_flag2 == Sleep_flag2&&
它抛出错误..
解析EntityName时发生错误
请帮帮我在这个
iam使用
xmlReader.ReadElementContentAsString();
这用于阅读
解决方案
您遇到此问题的原因是因为&
是XML中的特殊字符。它表示一个转义序列,所以它通常先于& lt;
之类的东西。您必须将此值包装在CDATA
中,否则您必须将每个&
转换为&放大器;放大器;
hi
i am reading a xml file iam pasting the part of it
<Command>CHECK</Command>
<ECUSignalName></ECUSignalName>
<ECUSignalValue>KeyPosition1 == KeyPosition1&&Sleep_flag2 == Sleep_flag2&&</ECUSignalValue>
<ECUSignalComment></ECUSignalComment>
but when it com to readin this
line
KeyPosition1 == KeyPosition1&&Sleep_flag2 == Sleep_flag2&&
it throwing error..
An error occurred while parsing EntityName
please help me on this
iam using
xmlReader.ReadElementContentAsString();
this for reading
解决方案
The reason you are getting this issue is because&
is a special character in XML. It indicates an escape sequence, so it normally precedes things like<
and the likes. You will either have to wrap this value in aCDATA
, or you will have to convert each&
into&
这篇关于在c#中读取xml问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文