<?xml version="1.0" ?> 
- <xml_api_reply version="1">
- <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
- <forecast_information>
  <city data="seoul" />
  <postal_code data="seoul" />
  <latitude_e6 data="" />
  <longitude_e6 data="" />
  <forecast_date data="2011-07-27" />
  <current_date_time data="2011-07-27 04:59:27 +0000" />
  <unit_system data="SI" />
  </forecast_information>
- <current_conditions>
  <condition data="비" />
  <temp_f data="75" />
  <temp_c data="24" />
  <humidity data="습도: 94%" />
  <icon data="/ig/images/weather/rain.gif" />
  <wind_condition data="바람: 남풍, 3 km/h" />
  </current_conditions>
- <forecast_conditions>
  <day_of_week data="수" />
  <low data="24" />
  <high data="27" />
  <icon data="/ig/images/weather/thunderstorm.gif" />
  <condition data="강우(천둥, 번개 동반)" />
  </forecast_conditions>
- <forecast_conditions>
  <day_of_week data="목" />
  <low data="24" />
  <high data="28" />
  <icon data="/ig/images/weather/thunderstorm.gif" />
  <condition data="강우(천둥, 번개 동반)" />
  </forecast_conditions>
- <forecast_conditions>
  <day_of_week data="금" />
  <low data="23" />
  <high data="29" />
  <icon data="/ig/images/weather/chance_of_storm.gif" />
  <condition data="광역성 뇌우" />
  </forecast_conditions>
- <forecast_conditions>
  <day_of_week data="토" />
  <low data="23" />
  <high data="29" />
  <icon data="/ig/images/weather/chance_of_storm.gif" />
  <condition data="국지성 뇌우" />
  </forecast_conditions>
  </weather>
  </xml_api_reply>


위 내용을 파싱하는 중인데요.

 while(parser.getEventType() != XmlPullParser.END_DOCUMENT) {
      switch(parser.getEventType()) {
      case XmlPullParser.START_DOCUMENT:            // 문서의 시작
       break;
      case XmlPullParser.END_DOCUMENT:        // 문서의 끝
       break;
      case XmlPullParser.START_TAG:
       Log.d("", "Start_tag 시작");
       
       kind=parser.getName();       
       System.out.println("Tag = " + kind);
       if(parser.getName().equals("current_conditions")){
        d_weather = new WeatherData();
       }
       if(parser.getName().equals("condition")){
        state = parser.getAttributeValue(0);
        d_weather.setState(state);
       }
       if(parser.getName().equals("temp_c")){
        temp = parser.getAttributeValue(0);
        d_weather.setState(temp);
       }
       if(parser.getName().equals("wind_condition")){
        wind = parser.getAttributeValue(0);
        d_weather.setState(wind);
       }
              
       if(parser.getName().equals("forecast_conditions")){
        break;
       }
       break;
      case XmlPullParser.END_TAG:
       break;
      case XmlPullParser.TEXT: 
       break;
      }
      parser.next();
     }
     m_adapter.add(d_weather);
    
<list선언>
ArrayList<WeatherData> m_weather = new ArrayList<WeatherData>();
 WeatherData d_weather;
 WeatherAdapter m_adapter;
<weatheradapter>
private class WeatherAdapter extends ArrayAdapter<WeatherData> {
  private ArrayList<WeatherData> items;
  public WeatherAdapter(Context backThread, int textViewResourceId, ArrayList<WeatherData> items) {
   super(backThread, textViewResourceId, items);
   this.items = items;   
  }
  public int size() {
   // TODO Auto-generated method stub
   return 0;
  }
  public View getView(final int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if(v == null) {
    LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    v = vi.inflate(R.layout.weather_row, null);
   }
   WeatherData w = items.get(position);
   TextView w_state = (TextView) v.findViewById(R.id.state);
   TextView w_tmn = (TextView) v.findViewById(R.id.tmn);
   TextView w_tmx = (TextView) v.findViewById(R.id.tmx);
   if(w != null) {
    if(w_state != null) {
     w_state.setText(w.getState());
    }
    if(w_tmn != null) {
     w_tmn.setText(w.getTmn());
    }
    if(w_tmx != null) {
     w_tmx.setText(w.getTmx());
    }     
   }   
   return v;
  }  
 }
<weatherdata class>
class WeatherData {
  private String State;
  private String Tmn;
  private String Tmx;
 
  public void setState(String _State) {
   this.State = _State;
  }
  public void setTmn(String _Tmn) {
   this.Tmn = _Tmn;
  }
  public void setTmx(String _Tmx) {
   this.Tmx = _Tmx;
  }
  public String getState() {
   return State;
  }
  public String getTmn() {
   return Tmn;
  }
  public String getTmx() {
   return Tmx;
  }
 }

소스는 이렇게 되어 있습니다.

 

m_adapter.add(d_weather)를 while문 밖으로 뺐더니

맨 마지막 데이터 한개만 들어가네요;;

START_TAG: 안에 넣으면 계속 반복되고 ㅠㅠ

리스트뷰 안에 날씨, 온도, 바람 세가지만 넣으려고 하는데

어떻게 추가를 시켜야 될까요 ㅠㅠ

어렵네요 ㅠㅠ