User Tools

Site Tools


public:t-vien-09-1:lab_1_materials

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:t-vien-09-1:lab_1_materials [2009/01/15 09:36]
hannes created
public:t-vien-09-1:lab_1_materials [2009/01/15 09:40] (current)
hannes
Line 102: Line 102:
 # We can extract XML elements by name (we get a list, but only take the first match) # We can extract XML elements by name (we get a list, but only take the first match)
 current_weather_element = rssweather_xml.getElementsByTagName("yweather:condition")[0] current_weather_element = rssweather_xml.getElementsByTagName("yweather:condition")[0]
-print "Current temperature is "+ current_weather_element.getAttribute("temp")+" deg."+print "Current temperature is "+ current_weather_element.getAttribute("temp")+" deg. Farenheit" 
 +# Here we got the attribute of an element node, but to get the text of a text node, we can use node.nodeValue
 </code> </code>
  
/var/www/ailab/WWW/wiki/data/pages/public/t-vien-09-1/lab_1_materials.txt · Last modified: 2009/01/15 09:40 by hannes