Created
April 14, 2015 07:55
-
-
Save Microsofttechies/ccf5f9c4b5db5d4a3f11 to your computer and use it in GitHub Desktop.
Read special characters back from XmlDocument in c#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To Get escapded values | |
| public string EscapeXMLValue(string value) | |
| { | |
| if (string.IsNullOrEmpty(s)) return s; | |
| string temp = s; | |
| temp = temp.Replace("'","'").Replace( "\"", """).Replace(">",">").Replace( "<","<").Replace( "&","&"); | |
| return temp ; | |
| } | |
| To get the unescaped value | |
| public string UnescapeXMLValue(string xmlValue) | |
| { | |
| if (string.IsNullOrEmpty(s)) return s; | |
| string temp = s; | |
| temp = temp.Replace("'", "'").Replace(""", "\"").Replace(">", ">").Replace("<", "<").Replace("&", "&"); | |
| return temp ; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment