I am new to using XMLRPC and I've very confused about what to do with a response once I get it. I'm writing an app in MSVC 6 to interface with Flickr. It just needs to download pictures from an account. I can create the connection to Flickr, send the request and receive a successful response. Once I get the response, I don't know what to do with it. How do I access the parts of the XML? I can print out the whole XML code, but I don't know how to isolate different parts of it. Here's an example response when I send a request to find a user:
The result from the flickr API XML-RPC call is a string (more precisely, it is an XmlRpcValue that holds a string). That is what you have printed out.
The string is actually (escaped) XML data, but that is independent of the XML-RPC call. As far as XML-RPC is concerned, the result is just a string.
In order for you to make use of the result, though, you have to interpret it. This is true no matter what request type (XML-RPC, SOAP, etc) you use to access the flickr API - you still have to interpret the XML that is returned to the client. You probably want to take the XML-encoded string and feed it into an XML parser. The output of the parser will provide access to the data you want.
Because the XML-RPC format is a simple subset of XML, the parsing utilities in xmlrpc++ will not be sufficient to do what you want (in particular, the parsing does not handle attributes in tags). I haven't used any of the small XML parsers but you can google small xml parsers c++ and find a bunch of them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fantastic. Thanks for your help. It turns out that the APi doesn't return the image data, but instead give all the image attributes and then I use them to construct the image URL and use the plain ol' HTTP protocol to download the image data.
I'll post a message here when I'm done with access to my code in case anyone is interested. I'm coding a lightweight application for DIY digital photo frames. I tried using Slickr, but my laptop I used to make the frame isn't powerful enough.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am new to using XMLRPC and I've very confused about what to do with a response once I get it. I'm writing an app in MSVC 6 to interface with Flickr. It just needs to download pictures from an account. I can create the connection to Flickr, send the request and receive a successful response. Once I get the response, I don't know what to do with it. How do I access the parts of the XML? I can print out the whole XML code, but I don't know how to isolate different parts of it. Here's an example response when I send a request to find a user:
<user id="27004136@N07" nsid="27004136@N07">
<username>tim_coombs</username>
</user>
How do I access the id part as a variable? Eventually, it will be returning JPEG image data in XML, so I need to be able to access that as well.
Thanks in advance.
The result from the flickr API XML-RPC call is a string (more precisely, it is an XmlRpcValue that holds a string). That is what you have printed out.
The string is actually (escaped) XML data, but that is independent of the XML-RPC call. As far as XML-RPC is concerned, the result is just a string.
In order for you to make use of the result, though, you have to interpret it. This is true no matter what request type (XML-RPC, SOAP, etc) you use to access the flickr API - you still have to interpret the XML that is returned to the client. You probably want to take the XML-encoded string and feed it into an XML parser. The output of the parser will provide access to the data you want.
Because the XML-RPC format is a simple subset of XML, the parsing utilities in xmlrpc++ will not be sufficient to do what you want (in particular, the parsing does not handle attributes in tags). I haven't used any of the small XML parsers but you can google small xml parsers c++ and find a bunch of them.
Fantastic. Thanks for your help. It turns out that the APi doesn't return the image data, but instead give all the image attributes and then I use them to construct the image URL and use the plain ol' HTTP protocol to download the image data.
I'll post a message here when I'm done with access to my code in case anyone is interested. I'm coding a lightweight application for DIY digital photo frames. I tried using Slickr, but my laptop I used to make the frame isn't powerful enough.