Deserialization fails ...

Topics: Developer Forum, User Forum
Mar 4, 2008 at 9:55 PM
When invoking flickr.getInterestingness() ... the response sometimes (for some reason that is beyond me) contains a blank entry such as the following...

<photo id="" owner="" secret="" server="" farm="0" title="" ispublic="" isfriend="" isfamily="" />.

This is causing deserialization to fail during this call

FlickrNet.Response response = (FlickrNet.Response)serializer.Deserialize(responseReader); (Utils.cs)

can this be fixed ?

I have the response xml available should you require it.

10x
Coordinator
Mar 5, 2008 at 11:01 AM
Hi

There are only two options available to me, both of which I am reluctant to pursue.

The first, and simplest would be to make ispublic, isfriend etc string variables, rather than integer variables. Since these variables should only ever contain 0 or 1 I'd actually prefer them to be booleans, rather than integers, so going to other way just makes me cringe.

The second solution is to stop using automatic serialization and implement the IXmlSerializable interface. I have considered this in the past but it is a very large amount of work, and I'm not sure there wouldn't be a performance hit.

The ideal solution would be for Flickr to stop screwing their damn XML up of course.

You're thoughts on the above two solutions would be helpful.
Mar 5, 2008 at 9:02 PM
Hi Sam,

Thanks for the quick reply. Yes the ideal solution would be for flickr to fix the problem. I raised this issue over to their mailing list but 24hrs have passed and no one has replied yet.
Maybe you might consider raising this issue on the mailing list as well (maybe they'll pay more attention to you since you've written the Flickr Net Api :D ).

Chris