First let's create an example of getting data from an XML file and updating the weather widget from its data. We will create a new web page called
weather.html and put the markup for the weather widget into it. This page will have a Check Weather button. When clicked, it will call the weather widget's
update() method. You can find the code for this example in
Next we need to create an XML file with some weather information in it. We will name the file
weather.xml and place it in the
<weather> <location>Your City</location> <current_observation> <weather>Snow</weather> <temperature_string>38.3 F (3.5 C)</temperature_string> <feelslike_string>38 F (3 C)</feelslike_string> <relative_humidity>76%</relative_humidity> ...