views:

10

answers:

0

I'm trying to parse some placemarks on a Google Earth .kml file. I'm creating the document, and going through the placemarks, and I'm able to access all placemark names, but I can't access their descriptions:

for (NSXMLNode *placemark in nodes) {
        NSArray *elements = [placemark nodesForXPath: @"name" error:&err];
        NSXMLNode *element = [elements objectAtIndex: 0];

        NSString *name = [element stringValue];
        NSLog(@"Name: %@", name); // OK

        elements = [placemark nodesForXPath: @"description" error:&err];

        if ([elements count] > 0) { // Never happens
            element = [elements objectAtIndex: 0];
            NSLog(@"Description: %@", [element stringValue]);
        }
}

I've checked the .kml file manually and there are some placemarks with descriptions. I've also tried to log the entire placemark node, and it shows no description.

Finally, I've tried to get all description nodes in the document, and I get all but the ones I need. I'm completely lost here.

Aditional info: I've tried to implement this with TBXML with the exact same behavior. I don't get why it doesn't parse the description elements... Any ideas?