How to extract deeper elements? #10

nfitzpatrick opened this Issue Dec 13, 2012 · 2 comments


None yet
2 participants

I am having trouble getting the following values from my XML file:

  1. media:content.duration
  2. media:group > media:content.bitrate
  3. media:group > media:content.expression
  4. media:category

Any help will be appreciated.

Sample from my XML file

        <title>dom cuce</title>
        <description>Dominick Cuce of Old Bridge discusses his team&amp;apos;s 5-1 victory over Woodbridge</description>
        <pubDate>Wed, 12 Dec 2012 16:53:29 -0800</pubDate>
        <media:content duration="39" medium="video" type="video/mp4" url=""/>
            <media:content bitrate="684" expression="full" />
        <media:category>Most Recent Videos</media:category>

My working code

this works but I don't know how to get the four elements listed above

SMXMLElement *channel = [document.root childNamed:@"channel"];
for (SMXMLElement *item in [channel childrenNamed:@"item"])
NSString *guid = [item valueWithPath:@"guid"];
NSString *title = [item valueWithPath:@"title"];
NSString *description = [item valueWithPath:@"description"];
NSString *pubDate = [item valueWithPath:@"pubDate"];


nfarina commented Dec 13, 2012


So SMXMLDocument can handle XML elements with namespaces (like your media: namespace), but discards them entirely after parsing. So what you're looking for is:

[item valueWithPath:@"category"];

Instead of specifying @"media:category".

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment