NSXMLParser attributeDict enumeration
NSXMLParser attributeDict enumeration
- Subject: NSXMLParser attributeDict enumeration
- From: Martijn van Exel <email@hidden>
- Date: Mon, 27 Apr 2009 17:10:04 +0200
Hi all,
This might be more of a C problem than a Cocoa problem per se.
Enumerating the values of an attribute dictionary in NSXMLReader I try to
set some members of a currentNode object (which does not represent an XML
node, confusingly):
NSEnumerator *enumerator = [attributeDict keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
NSLog(@"considering key %@",key);
if([key isEqualToString:@"lat"])
{
currentNode.lat = (double)[attributeDict objectForKey:key];
}
Member 'lat' is a double. The above does not work. 'Pointer value used where
float was expected'. So I should dereference?
currentNode.lat = (double *)[attributeDict
objectForKey:key];
does not work either: 'error: incompatible type for argument 1 of
'setLat:''. I guess it wouldn't, because I'm casting an (id) to a pointer to
a double I think, but I'm not sure how I should be doing this.
martijn van exel -+- email@hidden -+- http://www.schaaltreinen.nl/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden