There is an error in xml document (8,72)
XML document below:
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jun 27, 2013, 12:56 PM
I tried changing it to 'True' and got a FormatException - the string 'True' is not a valid Boolean value.
However, when you use the XML serializer to serialize an object in the first place, it does generate lower case values, so at least it's consistent :)
David SmithPosted Jun 27, 2013, 11:41 AM
David SmithPosted Jun 27, 2013, 11:40 AM
XmlSerializer s= new XmlSerializer(typeof(ColorObject));
TextReader textReader = new StreamReader(fName);
colorfile = (ColorObject)s.Deserialize(textReader );
tr.Close();
VulpesPosted Jun 27, 2013, 10:33 AM
If you're reading it as a string and then using Convert.ToBoolean, it doesn't matter about capitalization - true, True, TRUE or even tRuE should all work.
True is probably the safest as that's what the System.Boolean.ToString() method produces for the C# value, true.
David SmithPosted Jun 27, 2013, 10:26 AM
VulpesPosted Jun 27, 2013, 2:27 AM
It should be: