无法加载包含@ entity的XML文档

时间:2016-07-13 11:35:10

标签: c# xml

您能否告诉我如何解决此问题:

XML文件:

<ref ref-type="sectiona">sdsadsd <email>EffectiveHealthCare@ahrq.hhs.gov</email>sdasd  &commat; Sec asdd</ref>
<ref ref-type="sec">test Sec</ref>
<ref ref-type="sec">seesdasdasd <email>EffectiveHealthCare &commat; dasdasdasd</email>asdad Sec</ref>
<ref ref-type="sec"> Sec</ref>

我的代码:

XmlDocument xmlDocFile = new XmlDocument();
xmlDocFile.Load("xmlfile");

例外

  

引用未声明的实体'commat'。第35行,第65位

1 个答案:

答案 0 :(得分:0)

使用此xml节点

<ref ref-type="sectiona"><![CDATA[sdsadsd <email>EffectiveHealthCare@ahrq.hhs.gov</email>sdasd  &commat; Sec asdd]]></ref>
<ref ref-type="sec">test Sec</ref>
<ref ref-type="sec"> Sec</ref>
<ref ref-type="sec"><![CDATA[seesdasdasd <email>EffectiveHealthCare &commat; dasdasdasd</email>asdad Sec]]></ref>

包含无效值的节点必须进行转义<![CDATA[....]]>

相关问题