I am trying to deserialize a xml string in C# using the following
XmlSerializer serializer = new XmlSerializer(typeof(Application));
App = (Application)serializer.Deserialize(xmlString);
It all works well when the xml is pretty printed, but when i have the whole xml in a single line deserializing fails with the error
There is an error in XML document (1, 2). Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2."
I've checked that the xml is valid as such.
Any one knows what can be done to overcome this problem?
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
While C and C++ may sound similar, their features and usage differ. C is a procedural programming language that support objects and classes. On the other hand C++ is an enhanced version of C programming with object-oriented programming support.
Chances are that you loading UTF-16 file as UTF-8 and as result every second character is 0.
If it is true - it could happen if you saved your original XML without BOM (byte order mark) or explicitly using wrong encoding while openeing file...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With