• 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
NSXMLParser useless with HUGE files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSXMLParser useless with HUGE files


  • Subject: NSXMLParser useless with HUGE files
  • From: Matt Gough <email@hidden>
  • Date: Wed, 14 Dec 2005 15:26:53 +0000

I have a 1.91GB (2,048,406,952 bytes to be precise) xml file that I am trying to parse. I thought that NSXMLParser would be able to cope with it, but it can't as it fails with NSXMLParserOutOfMemoryError.


E.g

NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL: [NSURL fileURLWithPath:path]];

[parser setDelegate:self];
[parser parse];
[parser release];


It seems that during initWithContentsOfURL it tries to read in the entire file! Why can't it just be streamed in as needed during [parser parse]?

So then I thought that maybe I could do:

NSData* mappedData = [NSData dataWithContentsOfMappedFile:path];
NSXMLParser* parser = [[NSXMLParser alloc] initWithData:mappedData];

But it still runs out of memory.

Would CFXMLParser be any better, or would it suffer the same problem?



BTW - Can anyone suggest a text editor that is able to work with such a file so that I can chop it down into more manageable portions that I can parse individually and then merge the results?

Matt Gough
Softchaos Limited
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: NSXMLParser useless with HUGE files
      • From: Todd Blanchard <email@hidden>
    • Re: NSXMLParser useless with HUGE files
      • From: Johan Kool <email@hidden>
    • Re: NSXMLParser useless with HUGE files
      • From: Markus Hitter <email@hidden>
    • Re: NSXMLParser useless with HUGE files
      • From: Annard Brouwer <email@hidden>
  • Prev by Date: Re: Updating System Menu bar
  • Next by Date: Re: Updating System Menu bar
  • Previous by thread: Re: WWDC 2005 DVDs [OT]
  • Next by thread: Re: NSXMLParser useless with HUGE files
  • Index(es):
    • Date
    • Thread