0

I want to deserialize special characters. This is the sample XML tag:

<Address1>125*1(&()*)1798</Address1>

How can I do that using XmlSerializer? I want to do this in the code in c# rather than changing the contents of the Xml because the file is being uploaded by the user. I can't ask the user to fix the contents in the XML. I want to rather handle this in C# code.

Any help is appreciated.

Jack
  • 7,433
  • 22
  • 63
  • 107
  • what happens when you try to deserialize it using XmlSerializer? – Andre Pena Apr 06 '15 at 04:30
  • @andrerpena: invalid characters at line XXX. – Jack Apr 06 '15 at 04:34
  • The `&` character is one of five [XML reserved characters](https://technet.microsoft.com/en-us/library/ms145315%28v=sql.90%29.aspx), and must be escaped when part of a text literal, like so: `&`. – dbc Apr 06 '15 at 06:09
  • Might be encoding related, some explanation here : http://stackoverflow.com/questions/4899872/fast-way-to-deserialize-xml-with-special-characters – flafoux Apr 07 '15 at 20:51

0 Answers0