• 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: NSXMLParserDelegateAbortedParseError
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParserDelegateAbortedParseError


  • Subject: Re: NSXMLParserDelegateAbortedParseError
  • From: glenn andreas <email@hidden>
  • Date: Tue, 08 Mar 2011 15:24:33 -0600

On Mar 8, 2011, at 3:13 PM, Josh Caswell wrote:

> Hi Kevin,
>
> Thanks for your reply.
>
> Sorry, maybe my explanation is not clear enough (I may have left out
> too many details). It's not a network error that I am talking about,
> but, as you say, an API error for which the server returns valid XML.
>
> The specifics:
> I'm requesting weather data for a location by latitude and longitude.
> If I give the server a request that has, for example, a bad latitude,
> it will return valid XML, which parses fine, with an error element and
> a message describing the problem with the request:
>
> <Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="http://na.unep.net/swera_ims/WS/SWERA.xsd";><Error>110</Error><ErrorMessage>Latitude
> point must be between -90 and 90</ErrorMessage></Data>
>
> If my parser comes upon an Error element, the delegate tells it to get
> the ErrorMessage contents and then aborts the parsing. Then the
> message ("Latitude point must be between...") is used for an alert
> sheet as I described.
>
> I'm just wondering why, after my delegate aborts the parse, the parser
> changes the error code.
>

Probably because the parser is reporting the "parse aborted" error?  From the header:

- (void)abortParsing;	// called by the delegate to stop the parse. The delegate will get an error message sent to it.

So you are getting an error because you aborted the parser (which knows not a thing about your concepts of "Error" and "ErrorMessage" as returned by the server):

- (NSError *)parserError;	// can be called after a parse is over to determine parser state.

This error is the parser state, which since you explicitly aborted the parse, will be something like "NSXMLParserDelegateAbortedParseError" -512.


Glenn Andreas                      email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL

_______________________________________________

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: NSXMLParserDelegateAbortedParseError
      • From: Josh Caswell <email@hidden>
References: 
 >NSXMLParserDelegateAbortedParseError (From: Kevin Bracey <email@hidden>)
 >Re: NSXMLParserDelegateAbortedParseError (From: Josh Caswell <email@hidden>)

  • Prev by Date: Re: NSXMLParserDelegateAbortedParseError
  • Next by Date: Re: NSXMLParserDelegateAbortedParseError
  • Previous by thread: Re: NSXMLParserDelegateAbortedParseError
  • Next by thread: Re: NSXMLParserDelegateAbortedParseError
  • Index(es):
    • Date
    • Thread