matto1376
09-02-2007, 12:02 PM
Hi Guys,
I am trying to get some data out of an xml file into a datagrid.
The XML looks like this:
<weather_au>
- <state name="NSW" timezone="EST" tz_hours="+10.0">
- <location name="Armidale" state="NSW">
- <observation station="056238" utc="200708292300" day="Thursday" date="20070830" time="0900">
<wind_bearing>60</wind_bearing>
<wind_dir>ENE</wind_dir>
<wind_spd_kts>5</wind_spd_kts>
<wind_spd_kph>9</wind_spd_kph>
<air_temp>14.1</air_temp>
<dew_pt>4.4</dew_pt>
<humidity>51.6</humidity>
<rain_9am>0</rain_9am>
<pressure>1030.7</pressure>
</observation>
I am after a Datagrid with the location name (which is an attribute) and the air_temp.
The air_temp is referenced like this -
XPath.selectNodes(this.firstChild, "/weather_au/state[@name = 'NSW']/location/observation/air_temp")
And it traces like this <air_temp>15<air_temp>, so no worries into the datagrid.
But the location, I don't know how to single out the location part, I either get all the observation data or just the location, as in Armidale.
Any ideas on how to get <location>Armidale<location> as a traced output??
Thanks!!
I am trying to get some data out of an xml file into a datagrid.
The XML looks like this:
<weather_au>
- <state name="NSW" timezone="EST" tz_hours="+10.0">
- <location name="Armidale" state="NSW">
- <observation station="056238" utc="200708292300" day="Thursday" date="20070830" time="0900">
<wind_bearing>60</wind_bearing>
<wind_dir>ENE</wind_dir>
<wind_spd_kts>5</wind_spd_kts>
<wind_spd_kph>9</wind_spd_kph>
<air_temp>14.1</air_temp>
<dew_pt>4.4</dew_pt>
<humidity>51.6</humidity>
<rain_9am>0</rain_9am>
<pressure>1030.7</pressure>
</observation>
I am after a Datagrid with the location name (which is an attribute) and the air_temp.
The air_temp is referenced like this -
XPath.selectNodes(this.firstChild, "/weather_au/state[@name = 'NSW']/location/observation/air_temp")
And it traces like this <air_temp>15<air_temp>, so no worries into the datagrid.
But the location, I don't know how to single out the location part, I either get all the observation data or just the location, as in Armidale.
Any ideas on how to get <location>Armidale<location> as a traced output??
Thanks!!