开发者

System.Xml.XmlException: Reference to undeclared entity 'AMP'. Line 88, position 68

I am getting the follow error, but not sure how to resolve it:

System.Xml.XmlException: Reference to undeclared entity 'AMP'. Line 88, position 68.

I found this section in the xml:

<AddressData city="TYNE &AMP; WEAR">
    <addressLine>123 Orange Rd.</addressLine>
    <addressLine></addressLine>
</AddressData>

The xml is actually being created dynamically, but when I stepped through it, I noticed that it is coming back as Tyne & Wear, but it is being uppercased which I have no 开发者_StackOverflow中文版idea why. There is a utility routing called XmlEncode that does the following, but not sure it would cover the above scenario.

s.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("'", "&apos;").Replace("""", "&quot;")


It sounds like the xml input contains an upper-cased &amp;. XML character entities are case-sensitive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜