[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xmlm input function with blocking



On 27 May 2013, at 15:08, Daniel Bünzli <daniel.buenzli@xxxxxxxxxxxx> wrote:
> 
>> Do you have any thoughts on how to support this in xmlm streaming API? A 
>> Would_block exception would be sufficient to signal a temporary failure, but 
>> then there also needs to be a function to restart the Xmlm parser from 
>> within the I/O loop.
> 
> Sure, that's exactly what non-blocking codecs solve [1]. If you use a `Manual 
> source you provide the buffer to read from and the computation suspends and 
> asks for more if it cannot proceed (Xmlm.input returns `Await).  
> 
> On my side, at the moment, only uutf [2] and jsonm [3] support that (and Vg's 
> "stored" -- file formats -- renderer). This is the reason why I eventually 
> need to make an incompatible Xmlm 2.0.0 rewritten on top of uutf.
> 
> A simple example showing usage of `Manual sources in uutf with Unix.read can 
> be found here [4] (the second function, lines_fd). It should convince you 
> that this is what you want.

Got it. I'm happy to go with jsonm actually.  I just need an example to 
illustrate interfacing parsing long running connections with Async Pipes, and 
JSON works just as well as XML for that purpose.

cheers,
Anil




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.