Louis J Scoras wrote:

> Hey all;
> 
> Net/http has a method for processing data in segments--by passing the
> get method a block--but is there an easy way to get to the socket
> directly?
> 
> The script I'm working on is grabbing a giant xml file from a remote
> site, and I want to process it as it comes in.

You mean, line by line? The socket class you are describing doesn't know
about lines, it knows about blocks. So try this: read a block, split it
into lines, do your processing. If you do this, you will discover some
blocks end in the middle of a line. Then you will say, "Gee, maybe I should
read the whole thing, then do the processing."

At that point, you  will understand why the class is written as it is.

> I've already changed 
> the code to use rexml's pull parser, so I'm guessing that now all I
> need to do is give it the correct IO handle and let it go.
> 
> I don't see anything in the docs about exposing the socket, and I
> don't want to rip open the class if there's something obvious I'm
> missing.  Any ideas on the best way to go about this?

Yep. Read the entire thing. Then process the result.

-- 
Paul Lutus
http://www.arachnoid.com