Save XML response

Topics: Developer Forum
Aug 16, 2011 at 6:57 PM

I am trying to save the result for each PhotosSearch as an XML (the raw XML returned by Flickr). Is that possible without manually putting the XML together?

I know there is a GetXmlDocument Method, but it is only available for UnknownResponse...

As long as it matters: I am writing in Visual Basic Express 2010 and I am not an expert in programming..
Thank you for help on this problem!

 

Coordinator
Aug 16, 2011 at 8:31 PM

I would ask why you are trying to save the raw XML. The whole point of the library is so you don't need the XML. Why not just save the PhotoCollection instead?

If you do need to see the XML then the LastRequest and LastResponse are probably the properties you want.

Sam

Aug 17, 2011 at 1:23 AM

I need to save the XML for importing them into Excel. That way, I can import these into GIS. It is just not possible to save 500+ XML by yourself from the Webinterface-Photosearch of Flickr manually, thats why I am writing on a program to get these XMLs easier. I just need the XY-Coordinates, since I am writing on a research project on locative data distribution.

I'll try the LastRequest and LastResponse Methods, Thank you for the hint!

Coordinator
Aug 17, 2011 at 6:14 AM

Surely if all you need are the lat and long then it would be simpler to just save the Latitude and Longitude off the Photo instances, rather than trying to get Excel to parse the XML to find that information.

Sam

Aug 17, 2011 at 7:01 PM

Thank you, Sam. As it turns out, I also like to do some statistics on DateTaken, Tags, Number of Owners and so on... LastResponse works actually great and for my problem, is the best solution for now. But now I ran into the problem, that lat/long somehow can not be returned from PhotosSearch because of the unhandled exception "Unknown attribute: geo_is_family=0" when using PhotoSearchExtras.geo (I already wrote it in the other threat from 2010).

Aug 17, 2011 at 7:21 PM

Sorry for all my messages! Actually, I am very happy about FlickrNet API and it's so easy to use (I am not a programmer). Found a solution by myself (since I only need the RAW XML, that solution might only work for me).


Try
Dim Photos As PhotoCollection = f.PhotosSearch(options)
Catch ex As FlickrException
 OutputTextBox.Text = f.LastResponse 'has latitude and longtitude!
End Try


Coordinator
Aug 17, 2011 at 8:35 PM

If you are using the released DLL then you shouldn't get that exception - that only happens with the Debug version of the library (which you would get if you downloaded the source directly).

Sam