Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at the <a href="http://developer.apple.com/iphone/library/samplecode/SeismicXML/Introduction/Intro.html" rel="nofollow noreferrer">SeismicXML</a> sample project from Apple. It gives you a general idea of how to use <code>NSXMLParser</code>, and is also written to parse the XML data in its own thread to allow the user to still interact with the UI. If you are looking for a nested tag (i.e. <code>&lt;body&gt;</code> within <code>&lt;item&gt;</code>), you will want a flag to tell if you are currently within the <code>&lt;item&gt;</code> tag or not. Otherwise you will parse all <code>&lt;body&gt;</code> tags.</p> <p>To address your second question, it depends on how you want to present this information to the user. If you want the text styled, you will need to use a UIWebView. Otherwise you can strip out what you need and have that spread out through a UITableView, or a custom view you create in Interface Builder.</p> <p><strong>Edit:</strong> After seeing your last comment, you need to create a flag (i.e. <code>insideBody</code>) and check for that inside of <code>foundCharacters:</code></p> <pre><code>- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ //NSLog(@"found characters: %@", string); // save the characters for the current item... if(insideBody == YES) { [currentBody appendString:string]; } else if ([currentElement isEqualToString:@"title"]) { [currentTitle appendString:string]; } else if ([currentElement isEqualToString:@"link"]) { [currentLink appendString:string]; } else if ([currentElement isEqualToString:@"summary"]) { [currentSummary appendString:string]; } else if ([currentElement isEqualToString:@"pubDate"]) { [currentDate appendString:string]; } else if ([currentElement isEqualToString:@"dc:creator"]) { [currentCreator appendString:string]; } } </code></pre> <p>You will probably have to do the same in <code>didStartElement:</code> and <code>didEndElement:</code>, as getting data from <code>foundCharacters:</code> will only give you the content of tags and not the tags themselves.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload