开发者

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

开发者 https://www.devze.com 2023-03-28 18:23 出处:网络
I am getting the follow error, but not sure how to resolve it: System.Xml.XmlException: Reference to undeclared entity \'AMP\'.

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

精彩评论

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