I am deserializing the following XML file. Using XML serializer with VSTS 2008 + C# + .Net 3.5.
Here is the XML file.
<?xml version="1.0" encoding="utf-8"?>
<Person><Name>=b?olu</Name></Person>
Here is the screen snapshot for the display of the XML file and binary format of the XML file,
If there are some solutions to accept such characters, it will be great! Since my XML file is big, and if such characters are really invalid and should be filtered, I want to keep remaining content of XML file after deserialization.
Currently XML deserialization fails with InvalidOperationException and the whole XML file information will be lost.
Actually, when open this XML file in VSTS, there is error like this, Error 1 Character '?', hexadecimal value 0xffff is illegal in XML documents. I am confused since in the binary form, there is no 0xffff values.
Any solutions or ideas?
EDIT1: here is my code which is used to deserialize XML file,
static void Foo()
{
XmlSerializer s = new XmlSerializer(typeof(Person));
StreamReader file = new StreamReader("bug.xml");
s.Deserialize(file);
}
public class Person
{
public string Name;
}