Z
Zachary P. Landau
[I posted this earlier but it never showed up. If this is a repeat, I apologize.]
Hello,
I'm having some trouble using REXML's parse_stream with an IOStream
(a stream returned from TCPServer.accept, to be specific). The data
is being received from the socket just fine, but when I call
REXML:ocument.parse_stream(stream, self) it blocks until all of the
XML has been received. I've traced the problem to REXML::SourceIO. Here
is the section with the problem (shortened in parts to make it smaller):
class IOSource < Source
def initialize(arg, block_size=3D500)
...
super @source.readline('>')[email protected]
end
end
So the code seems to block until it is all read. I'm not sure of the
purpose of having the readline first, since it reads the XML until it
reaches a >, and then reads the rest. Seems kind of pointless.
There's some commented out code that was from before readline was used,
which reads 500 bytes at a time. This worked because it didn't block,
but the best solution seems to be replacing the above super line with:
super @source.readline('>')
So I guess my question is, why is the (e-mail address removed) there? Is it a
mistake, or am I missing something? I can fix the problem by redefining
the initializer for IOSource, but then 1) I get a warning and 2) it
seems like either a bug should be fixed or my understanding of what is
going on should be fixed.
Hello,
I'm having some trouble using REXML's parse_stream with an IOStream
(a stream returned from TCPServer.accept, to be specific). The data
is being received from the socket just fine, but when I call
REXML:ocument.parse_stream(stream, self) it blocks until all of the
XML has been received. I've traced the problem to REXML::SourceIO. Here
is the section with the problem (shortened in parts to make it smaller):
class IOSource < Source
def initialize(arg, block_size=3D500)
...
super @source.readline('>')[email protected]
end
end
So the code seems to block until it is all read. I'm not sure of the
purpose of having the readline first, since it reads the XML until it
reaches a >, and then reads the rest. Seems kind of pointless.
There's some commented out code that was from before readline was used,
which reads 500 bytes at a time. This worked because it didn't block,
but the best solution seems to be replacing the above super line with:
super @source.readline('>')
So I guess my question is, why is the (e-mail address removed) there? Is it a
mistake, or am I missing something? I can fix the problem by redefining
the initializer for IOSource, but then 1) I get a warning and 2) it
seems like either a bug should be fixed or my understanding of what is
going on should be fixed.