ios xml NSString to longitude

maihao.hut

New Member
I have tried every way I can think of with this, but just not getting it.I have a XML file that has entries like these...\[code\]<lat>53.358242</lat><lon>-6.227800</lon>\[/code\]The file is parsed with NSXMLParser and get the other stuff out, but just can't feed these into the annotation to drop a pin.In the .h file I have the following;\[code\]@interface LocationList : NSObject@property (nonatomic, strong) NSString *loc_name;@property (nonatomic, strong) NSString *lat;@property (nonatomic, strong) NSString *lon;\[/code\]Then I try to convert the NSString to the coordinate with..\[code\]CLLocationCoordinate2D pinCoordinate;pinCoordinate.latitude = [theLocationList.lat doubleValue]; pinCoordinate.longitude = [theLocationList.lon doubleValue]; \[/code\]But I end up with 0.I tried this, but it couldn't handle the negative value.\[code\]NSString *digits = [theLocationList.lon stringByTrimmingCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];NSLog(@"Attempts: %f", [digits floatValue]);\[/code\]Anyone that can give me a dig out?
 
Back
Top