2010-09-25 6 views
2

Depuis jours, j'essaye d'analyser un flux YOUTUBE-XML en utilisant GDATA-API pour iOS.Parse youtube playlist sur iphone sdk/iOS

http://code.google.com/intl/de-DE/apis/youtube/2.0/developers_guide_protocol_channel_search.html

NSDictionary *namespaces = [NSDictionary dictionaryWithObjectsAndKeys: 
     @"http://www.w3.org/2005/Atom", @"", 
     @"http://schemas.google.com/g/2005", @"gd", 
     @"http://a9.com/-/spec/opensearch/1.1/",@"opensearch", 
     @"http://gdata.youtube.com/schemas/2007",@"yt", 
     @"W/"DkYGRH48fCp7ImA9Wx5WFEw."",@"gd:etag", 
     nil]; 

NSError *error = [[NSError alloc] init]; 
GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:receivedData options:0 error:nil]; 

NSArray *elements = [doc nodesForXPath:@"//entry" namespaces:namespaces error:&error]; 

Je ne reçois aucun résultat. Est-ce que quelqu'un a une solution à cela? Merci d'avance!

Répondre

0

Voici comment j'utilise cette API

NSArray *entries = [doc.rootElement elementsForName:@"entry"]; 
for (GDataXMLElement *e in entries) { 
// do something.. 
} 
0

Il est documentation sur l'API Objective-C GData, et un exemple d'application pour l'utilisation de l'API GData YouTube est here.

0

J'ai rencontré un problème similaire, il ne semble pas fonctionner correctement avec un espace de noms sans préfixe.

Essayez de changer:

@"http://www.w3.org/2005/Atom", @"", 

à

@"http://www.w3.org/2005/Atom", @"atom", 

et votre XPath:

@"//entry" 

à

@"//atom:entry" 
Questions connexes