Ok, here's the xml
...and here's my schema
...and the template
So I would like it structured like this:
So I am clearly doing it WRONG :) Since I'm only iterating over the weekday bits (so I wouldn't be able to get the current conditions).
How should I be re-working this?
<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="Hamilton, ON"></city> <postal_code data="Hamilton,ON"></postal_code> <latitude_e6 data=""></latitude_e6> <longitude_e6 data=""></longitude_e6> <forecast_date data="2011-11-21"></forecast_date> <current_date_time data="2011-11-21 13:00:00 +0000"></current_date_time> <unit_system data="US"></unit_system> </forecast_information> <current_conditions> <condition data="Mostly Cloudy"></condition> <temp_f data="30"></temp_f> <temp_c data="-1"></temp_c> <humidity data="Humidity: 69%"></humidity> <icon data="/ig/images/weather/mostly_cloudy.gif"></icon> <wind_condition data="Wind: N at 10 mph"></wind_condition> </current_conditions> <forecast_conditions> <day_of_week data="Mon"></day_of_week> <low data="28"></low> <high data="41"></high> <icon data="/ig/images/weather/sunny.gif"></icon> <condition data="Clear"></condition> </forecast_conditions> <forecast_conditions> <day_of_week data="Tue"></day_of_week> <low data="37"></low> <high data="46"></high> <icon data="/ig/images/weather/chance_of_rain.gif"></icon> <condition data="Chance of Rain"></condition> </forecast_conditions> <forecast_conditions> <day_of_week data="Wed"></day_of_week> <low data="32"></low> <high data="50"></high> <icon data="/ig/images/weather/mostly_sunny.gif"></icon> <condition data="Mostly Sunny"></condition> </forecast_conditions> <forecast_conditions> <day_of_week data="Thu"></day_of_week> <low data="43"></low> <high data="50"></high> <icon data="/ig/images/weather/sunny.gif"></icon> <condition data="Clear"></condition> </forecast_conditions> </weather></xml_api_reply>...and here's my schema
schema: { // specify the the schema is XML type: "xml", // the XML element which represents a single data record data: "/xml_api_reply/weather/forecast_conditions", // define the model - the object which will represent a single data record model: { fields: { day_of_week: "day_of_week@data", high: "low@data", low: "high@data", icon: "icon@data", condition: "condition@data" } } },...and the template
<ul id="weather-container"></ul><script id="dashwidget-weather-template" type="text/x-kendo-template"> <li> <div>#= day_of_week #</div> <div>#= condition #</div> <div>High: #= high #</div> <div>Low: #= low #</div> </li></script>So I would like it structured like this:
<div> <div>CURRENT WEATHER</div> <ul> #repeater <li>DAILY WEATHER</li> #endrepeater </ul></div>So I am clearly doing it WRONG :) Since I'm only iterating over the weekday bits (so I wouldn't be able to get the current conditions).
How should I be re-working this?