• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: program termination after releasing self defined NSXMLParser class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: program termination after releasing self defined NSXMLParser class


  • Subject: Re: program termination after releasing self defined NSXMLParser class
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 17 Apr 2010 11:44:48 -0500

On 16 Apr 2010, at 11:34 AM, Alexander Spohr wrote:

> Yes. The docs state:
> -parse
> Starts the event-driven parsing operation.
>
> That means that -parse does not block. It runs in the event loop.
> So the parser starts running and wants to talk to its delegate. But too bad - you released it right after it started to work.
>
> You have to retain it as long as the parsing takes. That is what the delegate is for.

I have not found this to be the case. In the context of the documents, and of the customary terms for XML parsing, "event-driven" parsing, provided by NSXMLParser, means that the parser yields elements one-by-one as it steps through the source. You'll note from the paragraph after the one you quote that -[NSXMLParser parse] returns "YES if parsing is successful and NO in there is an error or if the parsing operation is aborted." This is impossible unless the parsing is done asynchronously.

This is opposed to "tree-based" parsing (NSXMLDocument), in which the product is returned as a hierarchy of nodes.

We've covered before crashes in which the delegate releases its parser while in a delegate method, which runs only while the parser object is still in use.

	— F

_______________________________________________

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

  • Follow-Ups:
    • Re: program termination after releasing self defined NSXMLParser class
      • From: Alexander Spohr <email@hidden>
    • Re: program termination after releasing self defined NSXMLParser class
      • From: Fritz Anderson <email@hidden>
References: 
 >program termination after releasing self defined NSXMLParser class (From: Dominic Dauer <email@hidden>)
 >Re: program termination after releasing self defined NSXMLParser class (From: Alexander Spohr <email@hidden>)

  • Prev by Date: Re: Zeroing out instance variables
  • Next by Date: Hard time with Webservice methods returning array
  • Previous by thread: Re: program termination after releasing self defined NSXMLParser class
  • Next by thread: Re: program termination after releasing self defined NSXMLParser class
  • Index(es):
    • Date
    • Thread