From: Louis J Scoras Date: 2006-11-03T06:49:31+09:00 Subject: Re: net/http and rexml On 11/2/06, Paul Lutus wrote: > You mean, line by line? The socket class you are describing doesn't know > about lines, it knows about blocks. Nope. Not line by line. All the parser should need is a token, and I should only have to read as much data as I need to complete one, so blocks would be fine. > 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." No, I wouldn't say that ;) I'd just read enough segments into a buffer until I could complete the next token. > > Yep. Read the entire thing. Then process the result. > Why? I should be able to start processing simultaneously. That's what the stream paradigm was developed for. What if I got three tokens into the xml and found that it was malformed? That would be an aweful waste of bandwidth, no? -- Lou.