XPath: Learn It!
So I’ve been trying to do some Facebook App stuff in Ruby on Rails (I already did some in PHP) and the RFacebook Gem uses this wacky XHTML/XML parser called “Hpricot.” The most experience I have with parsing XML is winging it with REXML until I got something that was somewhat correct.
So I tried using Hpricot tonight. Apparently it’s super fast, but the documentation assumes you know a whole lot about the mating habits (internal workings) of HTML and XML. And… I don’t really.
At least, not until I found this handy XPath tutorial! After actually reading the tutorial, rather than trying to wing/hack it again, I think I have a pretty good feel for this Hpricot thing. Basically, there’s a pretty simple vocabulary for describing the nested nature of XML. It’s impossible to figure out from the Hpricot tutorials (which I tried doing for a while), but insanely simple once you just look at the tutorial. Ah well, I guess that’ll teach me a lesson not to hack so much when it’s easier to RTFM…