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

Re: NSXMLDocument Crashing


  • Subject: Re: NSXMLDocument Crashing
  • From: Ken Tozier <email@hidden>
  • Date: Wed, 29 Aug 2007 03:02:50 -0400

Hi Brad

A few weeks back I was having strange crashes with data returned from NSURLConnection and found the following code worked for me. My errors seemed to be encoding related, so this may not work in your case, but it's worth a shot. Depending on what lives at the URL (HTML or XML) you might want to replace "NSXMLDocumentTidyHTML " with "NSXMLDocumentTidyXML"

NSXMLDocument *queryResult = [[NSXMLDocument alloc] initWithContentsOfURL: testURL
options: NSXMLDocumentTidyHTML
error: &err];


HTH

Ken


On Aug 28, 2007, at 9:40 PM, Brad Miller wrote:

Hi,

I'm getting a crash when creating an NSXMLDocument. It appears that having an unknown entity in the xml data is the trigger. It doesn't happen all of the time though, I'm getting it maybe 1 out of 100 tries. The two times I've caught it, the xml had an unknown/ bad entity in it (one was eacute and the other an un-escaped &). So I think that's what's triggering the crash inside of libxml. The stack trace I'm getting on the crash is:

Thread 0 Crashed:
0 libobjc.A.dylib 0x90a594c7 objc_msgSend + 23
1 libxml2.2.dylib 0x91bf6fab __xmlRaiseError + 966
2 libxml2.2.dylib 0x91c042bf xmlParseExternalID + 1084
3 libxml2.2.dylib 0x91c04592 xmlParseDocTypeDecl + 357
4 libxml2.2.dylib 0x91bec2e2 xmlParseChunk + 5055
5 libxml2.2.dylib 0x91c870e3 xmlUCSIsCatZs + 2205
6 libxml2.2.dylib 0x91be6482 xmlTextReaderRead + 265
7 com.apple.Foundation 0x928691b0 -[NSXMLTreeReader parse] + 108
8 com.apple.Foundation 0x9286883c -[NSXMLDocument initWithData:options:error:] + 964
9 com.CynicalPeak.Cyndicate 0x00010685 -[IRConnection parseData] + 369 (IRConnection.m:810)
10 com.CynicalPeak.Cyndicate 0x0000ec05 -[IRConnection connectionDidFinishLoading:] + 28



The xml data is being loaded from the internet using an NSURLConnection. When the connectionDidFinishLoading: callback is received I'm simply taking the data that was received and calling doc = [[NSXMLDocument alloc] initWithData:data options:nil error:&err];


Does anyone have any ideas or suggestions for fixing the crash?

Thanks,

Brad
_______________________________________________

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:
40comcast.net


This email sent to email@hidden

_______________________________________________

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: NSXMLDocument Crashing
      • From: Brad Miller <email@hidden>
References: 
 >NSXMLDocument Crashing (From: Brad Miller <email@hidden>)

  • Prev by Date: Re: NSXMLDocument freezes UI
  • Next by Date: Re: seemingly simple Core Data fetch question
  • Previous by thread: NSXMLDocument Crashing
  • Next by thread: Re: NSXMLDocument Crashing
  • Index(es):
    • Date
    • Thread