According to Martijn van Exel:

> 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 structure member may be a double, but the dictionary object isn't.
I'm not familiar with NSXMLReader, but the dictionary probably has
a string of the attribute value.

> 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 -+- mve...@gmail.com -+- http://www.schaaltreinen.nl/
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/drew%40furrfu.com
> 
> This email sent to d...@furrfu.com

-- 
Drew Lawson            | "Look!  A big distracting thing!"
                       |     -- Crow T. Robot.
                       |
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to