Search in sources :

Example 1 with CityModel

use of tk.woppo.sunday.model.city.CityModel in project SunDay by iQuick.

the class CitySaxParseHandler method startElement.

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    super.startElement(uri, localName, qName, attributes);
    //        LogUtil.i(TAG, "start read tag - " + localName);
    this.tagName = localName;
    if (tagName.equalsIgnoreCase("province")) {
        //省
        mProvicneModel = new ProvicneModel();
        mProvicneModel.setCityName(attributes.getValue("name"));
        mProvicneModel.setCityId(attributes.getValue("id"));
    } else if (tagName.equalsIgnoreCase("city")) {
        //市
        mCityModel = new CityModel();
        mCityModel.setCityName(attributes.getValue("name"));
        mCityModel.setCityId(attributes.getValue("id"));
    } else if (tagName.equalsIgnoreCase("county")) {
        //区/县
        mAreaModel = new AreaModel();
        mAreaModel.setCityName(attributes.getValue("name"));
        mAreaModel.setCityId(attributes.getValue("id"));
        mAreaModel.setWeatherCode(attributes.getValue("weatherCode"));
    }
}
Also used : ProvicneModel(tk.woppo.sunday.model.city.ProvicneModel) CityModel(tk.woppo.sunday.model.city.CityModel) AreaModel(tk.woppo.sunday.model.city.AreaModel)

Aggregations

AreaModel (tk.woppo.sunday.model.city.AreaModel)1 CityModel (tk.woppo.sunday.model.city.CityModel)1 ProvicneModel (tk.woppo.sunday.model.city.ProvicneModel)1