Thursday, 5 February 2015

Use GDataXMLNode to Parse media:thumbnail URL



In my iOS app I use the GdataXMLNode class to help parse an XML. The XML in question has a section like this:



<media:content><media:player url="http://ift.tt/1zdWy2I;
<media:credit role="author" scheme="http://vimeo.com/karns"></media:credit>
<media:thumbnail height="150" width="200" url="http://ift.tt/1zV3kkC;
<media:title>Grace Anatomy (Steve Higginbotham)</media:title>
</media:content>


I am trying to get the url from the section


I have tried using:



NSString *nodes = [[[[item elementsForName: @"media:thumbnail"] lastObject] attributeForName: @"url"] stringValue];


But this returns back null. If I check


NSArray *questions = [item elementsForName:@"media:content"];


I get this:



(


"GDataXMLElement 0x7ffed300c110: {type:1 name:media:content xml:\"<media:content><media:player url=\"http://ift.tt/1zdWArd\"/><media:credit role=\"author\" scheme=\"http://vimeo.com/karns\"/><media:thumbnail height=\"150\" width=\"200\" url=\"http://ift.tt/1zV3kkG\"/><media:title>The Fifth Gospel (Steve Higginbotham)</media:title></media:content>\"}"


)


So, how can I return the url from within from this?


No comments:

Post a Comment