Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

How to extract deeper elements? #10

Closed
nfitzpatrick opened this Issue · 2 comments

2 participants

@nfitzpatrick

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

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

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
Owner

Hello,

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".

@nfitzpatrick

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.