From: Aaron Patterson Date: 2009-01-11T05:48:12+09:00 Subject: Re: Help with HTML parsing On Sun, Jan 11, 2009 at 04:09:54AM +0900, Phlip wrote: >> Couldn't you use CSS selectors when targeting XHTML (or XML even)? > >> puts doc.at('.one.two').content > > I'm going to. As soon as I get off my lazy butt, I will make nokogiri > into a pluggable back-end to the DSL. Then the CSS selection notation is > free. > > But I can't make the DSL itself into a CSS hybrid because that would > disadvantage the other pluggable XML parsers. So if you want pure XML > compliance, use REXML, if you want some XHTML awareness use LibXML, and > if you want CSS notation use Nokogiri. (After I'm done!) The CSS to XPath conversion can stand alone as a pure ruby library. Feel free to take it from my source if you like. Then you can give CSS notation to anything that supports XPath. :-) -- Aaron Patterson http://tenderlovemaking.com/