From: Ross Bamford Date: 2007-01-03T20:05:07+09:00 Subject: Re: Ruby classes and objects from XML On Wed, 03 Jan 2007 10:47:46 -0000, Robert Klemme wrote: > On 03.01.2007 10:57, Imobach Gonz叩lez Sosa wrote: >> I have an XML file generated from TaskJuggler[1] and I'd like to have >> the objects described in that file (Projects, Resources, Tasks and >> Bookings) available as Ruby classes and objects, so I can write >> reports about the project. >> In summary, I have and XML file (argh!) and I want to convert it >> "automagically" into Ruby classes ("struct"-like classes will suffice) >> and objects, without having to write a "parser". >> Does exist any library/module that could do that job? >> [1] http://www.taskjuggler.org/ > > [snipped good suggestions] > > Note, there are other XML parsers for Ruby around. I prefer to start > wiht REXML and only convert to something else if performance is an issue > simply because it's part of the standard distribution and has a nice > interface. > Just to add, if performance is an issue in this case, or if the OP simply fancies a change, theres DigestR which is custom-designed for this sort of parsing: http://digestr.rubyforge.org/ There's also the older, REXML-based xmldigester, but I don't know it's current status I'm afraid: http://xmldigester.rubyforge.org/ Cheers, -- Ross Bamford - rosco@roscopeco.remove.co.uk