XML Parsing in Ruby

I’ve recently started learning Ruby (and Rails) after seeing a coworker use RoR to quickly throw together a web app with all the goodies: AJAX, MySQL backend, pretty Web 2.0 theme, etc. I’ve gotten rather tired of Nike’s flash-based web app for their iPod sport kit, so I decided parsing the XML files on my iPod Nano would be good Ruby practice and familiarize me with Nike’s XML. I threw together a quick script that parses the Nike+iPod data and prints it out. You can get it here. If you’re too lazy to copy one of the XML files off your iPod (or too lazy to run, or too poor/nonconformist to buy an iPod, etc), I’ve also got a test file. I haven’t tried XML parsing in too many other languages, but Ruby makes it pretty easy. Iterating over a bunch of the same kind of elements is very handy. I’m working on turning this into a full web app that lets you upload XML files and track your runs (basically a version of Nike’s website without the suck), but I don’t think it’s ready yet. When I get it closer to done I’ll make the SVN repo public and set up a production copy.



When commenting, remember: Is it true? Is it necessary? Is it kind?


Go dark.