2013-01-03 5 views
0

Ray Wenderlich의 가이드를 사용하기 전에 xml 구문 분석을 수행했지만 일반적으로 여러 항목이 관련된 경우에 사용합니다. 앱이 주어진 시간에 기상 조건을 단순히 표시하도록하는 데 노력하고 있으며 피드의 XML에 시간 확인 조건이 있습니다. 조건 태그 :iOS 심플 XML 구문 분석

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
     <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> 
      <channel> 

<title>Yahoo! Weather - Montgomery, AL</title> 
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Montgomery__AL/*http://weather.yahoo.com/forecast/USAL0375_f.html</link> 
<description>Yahoo! Weather for Montgomery, AL</description> 
<language>en-us</language> 
<lastBuildDate>Thu, 03 Jan 2013 11:55 am CST</lastBuildDate> 
<ttl>60</ttl> 
<yweather:location city="Montgomery" region="AL" country="United States"/> 
<yweather:units temperature="F" distance="mi" pressure="in" speed="mph"/> 
<yweather:wind chill="43" direction="0" speed="5" /> 
<yweather:atmosphere humidity="66" visibility="10" pressure="30.26" rising="2" /> 
<yweather:astronomy sunrise="6:46 am" sunset="4:52 pm"/> 
<image> 
<title>Yahoo! Weather</title> 
<width>142</width> 
<height>18</height> 
<link>http://weather.yahoo.com</link> 
<url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url> 
</image> 
<item> 
<title>Conditions for Montgomery, AL at 11:55 am CST</title> 
<geo:lat>32.38</geo:lat> 
<geo:long>-86.3</geo:long> 
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Montgomery__AL/*http://weather.yahoo.com/forecast/USAL0375_f.html</link> 
<pubDate>Thu, 03 Jan 2013 11:55 am CST</pubDate> 
<yweather:condition text="Mostly Cloudy" code="28" temp="46" date="Thu, 03 Jan 2013 11:55 am CST" /> 
<description><![CDATA[ 
<img src="http://l.yimg.com/a/i/us/we/52/28.gif"/><br /> 
<b>Current Conditions:</b><br /> 
Mostly Cloudy, 46 F<BR /> 
<BR /><b>Forecast:</b><BR /> 
Thu - Partly Cloudy. High: 50 Low: 31<br /> 
Fri - Sunny. High: 57 Low: 35<br /> 
<br /> 
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Montgomery__AL/*http://weather.yahoo.com/forecast/USAL0375_f.html">Full Forecast at Yahoo! Weather</a><BR/><BR/> 
(provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/> 
]]></description> 
<yweather:forecast day="Thu" date="3 Jan 2013" low="31" high="50" text="Partly Cloudy" code="30" /> 
<yweather:forecast day="Fri" date="4 Jan 2013" low="35" high="57" text="Sunny" code="32" /> 
<guid isPermaLink="false">USAL0375_2013_01_04_7_00_CST</guid> 
</item> 
</channel> 
</rss> 

기본적으로,이 응용 프로그램에 필요한 모든 항목 태그에서 yweather에 포함되어 현재 온도와 조건이 있습니다 : 여기에 문제의 사료입니다. GDataXML을 사용하면이 정보를 가져 와서 NSString과 동일한 값을 설정하는 가장 간단한 방법은 무엇입니까?

지금 당장은 asihttprequest와 블록을 정렬하고 NSMutableArray에 모두 넣으려는 Ray의 튜토리얼에서 복잡한 내용을 사용하고 있지만 복잡한 것은 필요하지 않습니다.

답변