• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSXMLParser attributeDict enumeration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSXMLParser attributeDict enumeration
      • From: Quincey Morris <email@hidden>
    • Re: NSXMLParser attributeDict enumeration
      • From: Drew Lawson <email@hidden>
  • Prev by Date: Re: NSDateFormatter bug in timeZone
  • Next by Date: Re: figuring out which TableView I am?
  • Previous by thread: Re: Scheduling application
  • Next by thread: Re: NSXMLParser attributeDict enumeration
  • Index(es):
    • Date
    • Thread