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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jun 26, 2013, 10:27 PM EDT
It should be:
David SmithRank #999 · 2K reputationPosted Jun 27, 2013, 6:26 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 27, 2013, 6:33 AM EDT
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 SmithRank #999 · 2K reputationPosted Jun 27, 2013, 7:40 AM EDT
XmlSerializer s= new XmlSerializer(typeof(ColorObject));
TextReader textReader = new StreamReader(fName);
colorfile = (ColorObject)s.Deserialize(textReader );
tr.Close();
David SmithRank #999 · 2K reputationPosted Jun 27, 2013, 7:41 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 27, 2013, 8:56 AM EDT
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 :)