Re: Asynchronous downloading and parsing of XML
Re: Asynchronous downloading and parsing of XML
- Subject: Re: Asynchronous downloading and parsing of XML
- From: Andreas Grosam <email@hidden>
- Date: Mon, 08 Aug 2011 10:34:41 +0200
On Aug 7, 2011, at 1:47 PM, Mikkel Islay wrote:
> Thanks for sharing with the list.
> ... Aren't you in effect throwing away the benefits of asynchronous loading?
No. Asynchronous routines can be implemented above a blocking interface. Blocking and asynchronous interfaces work well together, and you may not even notice the existence of a blocking interface since it is working under the hood as an implementation detail.
For instance the parser *could* (we don't know) be implemented as a "recursive decent" parser. This kind of parser will effectively require that the parsing routine blocks, when there is no further input available, since the state of the parser will be in its call stack. So you can't just stop and exit the parse function in the middle of a stream, and then continue with a newly invoked method when more data is available.
The parser would just dispatch its events on the main thread where the delegate can handle them. So, from the view point of the delegate, it looks like an asynchronous interface.
Andreas
> The NSInputstream can block, and NSXMLParser presumably will. You will also have to deal with events in several places, and make sure errors are propagated up and down the stream.
>
> Mikkel
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden