Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-23-2008, 11:37 PM   #21 (permalink)
varchar
Registered Member
 
Join Date: Aug 2008
Posts: 95
Default

BMZero,

Glad that this thread is helping you...

I too am a .NET Developer and recently in past few months been staying up ever night learning objective-C and SDK very well...

To answer your question:


I am assuming you are familiar with the XMLParser, since that seems to be best (and probably only way) to parse XML...

See below... it may help you....


Code:


- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{			
   // NSLog(@"found this element: %@", elementName);
	currentElement = [elementName copy];
	if ([elementName isEqualToString:@"int"]) {
		myInt = [[NSMutableString alloc] init]; // Notice I am alloc as a NSmutablestring, you can change this to int (not not alloc it)
		
		
	}
	
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{     
	
	if ([elementName isEqualToString:@"int"]) {
		// Below is a hack, because the vars do not get saved between methods
		finalMyInt = @"";
		finalMyInt = [finalNearByLatitudes stringByAppendingString:nearbyLatitudes];
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
	
	if ([currentElement isEqualToString:@"int"]) {
		[MyInt appendString:string];
	}
	
//	NSLog(@"found characters: %@", string);
}
varchar is offline   Reply With Quote
 

» Advertisements
» Online Users: 268
22 members and 246 guests
ADY, aikhan, AppAnnex, astalavista, chemistry, HemiMG, her-ur, ilmman, leahov, MarkC, marto1914, mer10, nicko, padsoftware, pavanindira, Raffaello, sneaky, syver, tathaastu, timle8n1, touchcream, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,219
Posts: 380,710
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:31 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.