[Chicago] BeautifulSoup gone bad

Kumar McMillan kumar.mcmillan at gmail.com
Wed Mar 18 16:00:48 CET 2009


On Tue, Mar 17, 2009 at 11:52 PM, Ian Bicking <ianb at colorstudy.com> wrote:
>> xpath has never appealed to me, though I suppose it's just the bee's
>> knees for the right applications.
>
> lxml also supports CSS.  For many things this is simpler, e.g.:
> "div.menu a" (all anchors in <div> elements with the class "menu"):
> http://css2xpath.appspot.com/?format=html&css=div.menu+a

whuh?  it says the xpath equiv is:

descendant-or-self::div[contains(concat(' ', normalize-space(@class),
' '), ' menu ')]/descendant::a

but I thought it was just:

//div[@class='menu']//a

is it because the latter does not descend recursively to match all sub
sub anchor elements?


More information about the Chicago mailing list