Humanized Xml tree navigation

On Aug 7, 2006, at 3:09 AM, NAKAMURA, Hiroshi wrote:

although its name indicates it.
I understand why you did this a little better after playing around
with the Flickr API yesterday.

I introduced this XML <-> Ruby mapping to avoid bothersome XML DOM
programming in Web Services (soap4r). Do you think xampl can help us
instead of XSD::Mapping?


Creating XML request with a Hash and creating Ruby object with
XSD::Mapping. Both are for XML <-> Ruby mapping. It’s enough
small but
when I come to create more complexed XML instance… How I can write
this with xampl?

Xampl is definitely targeted at XML that you want to convert into an
object model. But I have used it for simply removing the DOM from
manipulating XML.

I had a look at the Flickr API yesterday. I don’t know much about
Flickr, I’m not a regular user of it. And I’ve never seen the API
before yesterday. So it seems that I don’t have a clear idea what
people do with the API. That leaves me thrashing around a bit. Any
suggestions as to what people, like you perhaps, want to do with the

Anyway I pretended I had a clue and carried on regardless. Here’s
where I got.

Xampl uses example documents to build Ruby objects that can hold any
of the example documents or any document ‘similar’ to the combined
examples. The Flickr API is SOAP (even the ‘REST’ API might as well
be SOAP) which means that the responses are not in general complete
representations of something useful (to xampl), they are fragments of
that. I’m not editorialising on SOAP here, but this explains the next
thing I did. So I started looking around for objects that were either
returned, or in desperation, could be constructed without having to
authenticate (I didn’t have the energy to read and figure out how
that works, yesterday was a holiday in Canada and I wanted to keep it
that way :slight_smile: Anyhow I settled on the ‘Photo’ (seems appropriate :slight_smile:

I figured I could get a fairly complete Photo object together by
using three API calls: – this gets an XML response that describes a
Photo – this gets pools and groups of the photo – this gets all the comments of the

And to get a list of photos to play with I used
flickr.interestingness.getList which returns the first N
‘interesting’ photos.

So anyway I got a few examples of each and ran xampl on the collection.

Then I wrote a short program to grab the interesting list, and build
up the objects with info, groups, pools, and comments. And made them

Now all I need to know is what to do with these photo objects???


// NaHi

Bob H. – blogs at <
Recursive Design Inc. –
Raconteur –
xampl for Ruby –

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs