From: "Bernard Delmée" Date: 2003-10-02T04:42:13+09:00 Subject: Re: HTML-Parser / SGML-Parser > ------------------------------------------------ > h = Net::HTTP.new('www.zachstestip.com' , 80 ) > resp,data = h.get('/index.php' , nil ) > > w = DumbWriter.new > f = AbstractFormatter.new(w) > p = HTMLParser.new(f) > p.feed(data) > p.close > ------------------------------------------------ > > Here comes the silly part. The function "feed" is inherited by > sgml-parser to html-parser. It passes "data" along to the sgml-parser > function "goahead". It prints everything to stdout or stderr( i dont > know, but it makes it to my screen =), but there is no print, put, > etc... etc... call to send it there!!! I cant for the life of me > determine where in the feed or goahead functions are outputting my > parsed results from data! This is damn silly of me to ask I know, but > how is it getting to my CLI? Through the DumbWriter. Check its implementation in ....\Ruby\lib\ruby\site_ruby\formatter.rb that's where the "write" statements live. Often times when you want to parse HTML, it is simpler to use the (misleadingly named) SGMLParser. Anyway these libraries are direct ports of python modules, and can only be understood by checking the documentation of the originals. See eg: http://www.python.org/doc/1.5.2/lib/module-sgmllib.html And usage examples (in python ;-) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52281 http://www.oreilly.com/catalog/pythonsl/chapter/ch05.html#t4 Cheers, Bernard.