iPhone OS Reference Library Apple Developer Connection spyglass button

Version: 1.8

Posted: 2009-05-13

Build Requirements: iPhone SDK 3.0

Runtime Requirements: iPhone SDK 3.0

View Source Code:

Download Sample Code (“SeismicXML.zip”, 58.6K)



Description

The SeismicXML sample application demonstrates how to use NSXMLParser to parse XML data. When you launch the application it downloads and parses an RSS feed from the United States Geological Survey (USGS) that provides data on recent earthquakes around the world. It displays the location, date, and magnitude of each earthquake, along with a color-coded graphic that indicates the severity of the earthquake. The XML parsing occurs on a background thread and updates the earthquakes table view with batches of parsed objects.

Document Revision History

Date Notes
2009-05-13Switched NSXMLParser to use initWithData: instead of initWithContentsOfURL: and implemented asynchronous NSURLConnection for download to give better control of network error handling. Consolidated parsing into app delegate for better handling of parse error callbacks and to avoid the design pattern of using the app delegate as a singleton for data access. Switched from custom UITableViewCell subclass to managing the layout with view tags to meet documented best practices. Modified Earthquake class to model numeric and date properties as numbers and dates instead of strings and merged string parsing code into the XML parsing code. Added use of the lat/lon data for opening Maps link.
2008-07-03First public release.
Did this document help you? Yes It's good, but... Not helpful...