FlickrNet.PhotosGetInfo throws FlickrNet.ParsingException: Unknown element: sizes

Mar 20, 2012 at 10:09 PM

This is because Flickr recently updated their flickr.photos.getInfo response to include a sizes node. I don't have time to submit a patch right now, but if anyone else is having trouble with this, they can update PhotoInfo.cs with the following:

 /// <summary>
 /// Collections of sizes available for this photo.
 /// </summary>
 public SizeCollection Sizes { get; set; }

private void LoadElements(System.Xml.XmlReader reader)
{
	while (reader.LocalName != "photo")
	{
		switch (reader.LocalName)
		{
			case "owner":
				ParseOwner(reader);
				break;
			case "title":
				Title = reader.ReadElementContentAsString();
				break;
			case "description":
				Description = reader.ReadElementContentAsString();
				break;
			case "visibility":
				ParseVisibility(reader);
				break;
			case "permissions":
				ParsePermissions(reader);
				break;
			case "editability":
				ParseEditability(reader);
				break;
			case "publiceditability":
				ParsePublicEditability(reader);
				break;
			case "dates":
				ParseDates(reader);
				break;
			case "usage":
				ParseUsage(reader);
				break;
			case "comments":
				CommentsCount = reader.ReadElementContentAsInt();
				break;
			case "notes":
				ParseNotes(reader);
				break;
			case "tags":
				ParseTags(reader);
				break;
			case "urls":
				ParseUrls(reader);
				break;
			case "location":
				Location = new PlaceInfo();
				((IFlickrParsable)Location).Load(reader);
				break;
			case "geoperms":
				GeoPermissions = new GeoPermissions();
				((IFlickrParsable)GeoPermissions).Load(reader);
				break;
			case "video":
				VideoInfo = new VideoInfo();
				((IFlickrParsable)VideoInfo).Load(reader);
				break;
			case "people":
				HasPeople = reader.GetAttribute("haspeople") == "1";
				reader.Skip();
				break;
			case "sizes":
				Sizes = new SizeCollection();
				((IFlickrParsable)Sizes).Load(reader);
				break;
			default:
				UtilityMethods.CheckParsingException(reader);
				reader.Skip();
				break;

		}
	}

	reader.Skip();
}

Cheers!

- ari

Coordinator
Mar 21, 2012 at 9:10 AM

I'm not seeing this data in the response from flickr.photos.getInfo. Could you supply a photo id that is returning this information?

Sam