Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Extension XML

Many feeds may also contain extension XML elements. If additional namespaces are used in a feed, use the extensionXMLElementsUsingNamespace: method to return an array of NSXMLElement objects. Pass the namespace URL, not the prefix, to the extensionXMLElementsUsingNamespace: method. If your feed had an entry like that in Listing 1-3, extensionXMLElementsUsingNamespace: returns an array of four NSXMLElement objects.

Listing 4-5 shows how to find a specific element in a particular namespace in an entry. In this example, the namespace is the iTunes Podcast.

Listing 4-5  Retrieving extension XML from an entry

// Find each element using the iTunes Podcast namespace
for( NSXMLElement *elem in [entry extensionXMLElementsUsingNamespace: @"http://www.itunes.com/dtds/podcast-1.0.dtd"] ) {
 
    // Check if the element is called "keywords"
    if (NSOrderedSame == [[elem localName] isEqualToString:@"keywords"]) {
 
        // If it is, print the data from the element to the log
        NSLog(@"keywords:%@", [elem stringValue]);
    }
}


< Previous PageNext Page > Hide TOC


Last updated: 2007-05-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice