The three XmlListModels are used to extract need information for display.
RssModeInfo.qml
XmlListModel { source: "http://www.google.com/ig/api?weather=forchheim" query: "/xml_api_reply/weather/forecast_information" //forecast information XmlRole { name: "city"; query: "city/@data/string()" } XmlRole { name: "forecast_date"; query: "forecast_date/@data/string()" } XmlRole { name: "current_date_time"; query: "current_date_time/@data/string()" }
RssModeCurrent.qml
XmlListModel { source: "http://www.google.com/ig/api?weather=forchheim" query: "/xml_api_reply/weather/current_conditions" //current condition XmlRole { name: "condition"; query: "condition/@data/string()" } XmlRole { name: "temp_c"; query: "temp_c/@data/string()" } XmlRole { name: "humidity"; query: "humidity/@data/string()" } XmlRole { name: "icon"; query: "icon/@data/string()" } XmlRole { name: "wind_condition"; query: "wind_condition/@data/string()" } }
RssModeDailyForecast.qml
XmlListModel { property int index source: "http://www.google.com/ig/api?weather=forchheim" query: "/xml_api_reply/weather" XmlRole { name: "day_of_week"; query: "forecast_conditions[" + index.toString() + "]/day_of_week/@data/string()" } XmlRole { name: "low_f"; query: "forecast_conditions[" + index.toString() + "]/low/@data/string()" } XmlRole { name: "high_f"; query: "forecast_conditions[" + index.toString() + "]/high/@data/string()" } XmlRole { name: "icon"; query: "forecast_conditions[" + index.toString() + "]/icon/@data/string()" } XmlRole { name: "condition"; query: "forecast_conditions[" + index.toString() + "]/condition/@data/string()" } }
Hi,
ReplyDeleteThank you very much for your post. I just have a question regarding how to use the RssModeDailyForecast model. How do I populate a list using this model? How do I use the index property correctly in order to get the data for all the days?
thank you
all the best