简体   繁体   中英

Why Do XML Entities Keep Literal Value in C# String?

I have an XML element with carriage return entities:

<expectedValue>Success:&#13;&#10;Your Payment information has been updated!</expectedValue>

I was expecting that when deserialized into an object with string property they would show as the C# escape characters such as:

Success:\\r\\nYour Payment information has been updated!

However the string still comes through with the literal entity values:

Success:&#13;&#10;Your Payment information has been updated!

Is there a way to have it deserialized as what I was expecting?

take a look at SecurityElement.Escape there you see all letters that get encoded/decoded. if you further non xml encoded the data in the xml you have to decode it accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM