Hello, I need to get the tag name from an XML file. I know where it is going to be everytime, but I do not know what the name will be. This is a snippet of my xml data.
I need to extract 'Thursday' from the tag to know what day the weather data is for. Tomorrow it will be Friday and so on and so forth. It will always be in the same place. I have tried this,
but it seems that I cannot use tagName in this manner. Any suggestions for me?
Code:
<Forecast> <Config/> <Date>THU SEP 9 2010</Date> <Time>4:53 PM CDT</Time> <Thursday> <Conditions>Partly Cloudy</Conditions> <Description>Partly cloudy</Description> <Image>http://www.</Image> <High>68°F</High> <Low>50°F</Low> <Pop>0</Pop> </Thursday>
Code:
forecast_node = doc.getElementsByTagName('Forecast')
current_day = forecast_node[0].childNodes[4].tagName
Comment