Return to Snippet

Revision: 27496
at June 11, 2010 12:24 by arpit


Initial Code
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"xml"];
	NSData *data = [NSData dataWithContentsOfFile:filePath];  
	if (data) { 
		NSError *error = nil;
		DDXMLDocument* doc = [[DDXMLDocument alloc]initWithData:data options:0 error:&error];
		
		if(error != nil){
			NSLog(@"DDXMLDocument create failed! Error - %@", [error localizedDescription]);
			return;
		}
		NSArray* results = [listingsXMLDoc nodesForXPath:@"//node" error:&error];
		NSLog(@"parsed: %i", [results count]);
	}

Initial URL

                                

Initial Description

                                

Initial Title
Using DDXML to parse an XML file

Initial Tags
xml, iphone

Initial Language
Objective C