From: Peter Szinek Date: 2006-12-17T19:51:47+09:00 Subject: Re: hpricot problem Hello, > Given this information, > I will show you how to extract the desired content with a few lines of > Ruby, no fuss, no undue complexity, no Hpricot. Why should it be complicated? What fuss? Who needs few lines? With the current version of hpricot this is exactly one line: doc//p[img]//text() > This is a scene in a much larger play, one in which someone says, > "Wow, I > had no idea there was such a powerful library, so carefully designed, > so > complete. But, notwithstanding its extraordinary features, > > > > > > > notwithstanding > the hundreds of man-hours expended creating it ... I can't get it to > > do what I want." You know, software is an evolving stuff. 3 (or 4, or something like this) days ago the above stuff was not available in HPricot, and since it was such a common query, and requested by people. voila: now it is there. Of course there will always be some missing features - no framework or library can solve all the problems of all mankind - but after some time, useful feedback (i.e. not 'forget about every framework since you can do it in a few lines of Ruby' but rather feature requests, bug reports etc) a framework can reach a maturity level where is solves most of the problems of its users. Btw. ever heard of 'reinventing the wheel'? Also your (otherwise great) code snippets always assume that the underlying HTML is well formed, and x and y and z - which is in real life almost never the case. Of course the posters here are not pasting 200K of HTML against which they run they production code, but a few lines of example which is usually an oversimplification of the problem. This another point where such libraries are great: they handle 844747 special cases (if your case is not among them, see the current-2nd paragraph, or add it there on your own) which is always a problematic thing in case of hand written stuff. I could state here 100 another points which would prove that in production, libraries are almost always better choice over hand written code on the fly - of course learning Ruby, playing with some features etc is another thing. I am not arguing that in this case one should not code everything on his own. However, there are some cases when people need a stable, working solution for something and don't want to play around with hand coded regexps against crappy HTML. In this case, IMHO, using a framework is absolutely OK. Cheers, Peter __ http://www.rubyrailways.com Best wishes, Peter __ http://www.rubyrailways.com