Delphi DeHL Deserialize XML File in newer class?
I use DeHL to serilize XML and class in Delphi and if add property to my class and try to deserialize my XML file. I have this error : ‘Deserializing « \TApp\FObject\test » failed. Serializer re开发者_StackOverflow社区ported it’s missing or other entity is currently read!’.
I understand quite well this problem but is there a way to put default value instead of error ?
Alex answer me this :
You should be able to — by annotating the “part2″ field with [XmlNullable]. This will tell the XML serializer to set the “part2″ field to NIL if it does not have an XML node.
Note that while this is possible it’s not recommended. Deserialized content should be serialized back to the original types otherwise “bad things” may happen.
I ask this question a long time ago on his site but I was not able to find where I ask this question : http://alex.ciobanu.org/?p=285#comments
精彩评论