Re: NSXMLParser useless with HUGE files
Re: NSXMLParser useless with HUGE files
- Subject: Re: NSXMLParser useless with HUGE files
- From: Todd Blanchard <email@hidden>
- Date: Wed, 14 Dec 2005 21:26:07 -0800
You could try a different parser:
http://homepage.mac.com/tblanchard/ObjectiveExpat
On Dec 14, 2005, at 7:26 AM, Matt Gough wrote:
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
_______________________________________________
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