I'm using SOAPpy to access weather data from the NOAA National Digital
Forecast Database XML Web Service [1] and I've been having
trouble figuring out how to parse the data.

The response comes back as XML document but when I check it with
type(result) it shows the the response is a string.  Does anyone have any
suggestions on getting relevant data? I've attached a sample SOAP response
to this post.

Thanks,
-Sean
<?xml version='1.0' ?>
<dwml version='1.0' xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
                    
xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd";>
   <head>
      <product concise-name="dwmlByDay" operational-mode="official" 
srsName="WGS 1984">
         <title>NOAAs National Weather Service Forecast by 12 Hour 
period</title>
         <field>meteorological</field>
         <category>forecast</category>
         <creation-date 
refresh-frequency='PT1H'>2007-08-31T21:35:20Z</creation-date>
      </product>
      <source>
         
<more-information>http://www.nws.noaa.gov/forecasts/xml/</more-information>
         <production-center>Meteorological Development Laboratory 
<sub-center>Product Generation Branch</sub-center></production-center>
         <disclaimer>http://www.nws.noaa.gov/disclaimer.html</disclaimer>
         <credit>http://www.weather.gov/</credit>
         <credit-logo>http://www.weather.gov/images/xml_logo.gif</credit-logo>
         
<feedback>http://www.weather.gov/survey/nws-survey.php?code=xmlsoap</feedback>
      </source>
   </head>
   <data>
      <location>
         <location-key>point1</location-key>
         <point latitude="39" longitude="-77" />
      </location>
      <time-layout time-coordinate="local" summarization="12hourly">
          <layout-key>k-p24h-n7-1</layout-key>
              <start-valid-time 
period-name="Today">2007-08-31T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-08-31T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Tomorrow">2007-09-01T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-01T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Sunday">2007-09-02T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-02T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Monday">2007-09-03T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-03T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Tuesday">2007-09-04T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-04T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Wednesday">2007-09-05T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-05T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Thursday">2007-09-06T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-06T18:00:00-04:00</end-valid-time>
      </time-layout>
      <time-layout time-coordinate="local" summarization="12hourly">
          <layout-key>k-p24h-n7-2</layout-key>
              <start-valid-time 
period-name="Tonight">2007-08-31T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-01T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Tomorrow 
Night">2007-09-01T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-02T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Sunday 
Night">2007-09-02T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-03T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Monday 
Night">2007-09-03T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-04T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Tuesday 
Night">2007-09-04T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-05T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Wednesday 
Night">2007-09-05T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-06T06:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Thursday 
Night">2007-09-06T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-07T06:00:00-04:00</end-valid-time>
      </time-layout>
      <time-layout time-coordinate="local" summarization="12hourly">
          <layout-key>k-p12h-n14-3</layout-key>
              <start-valid-time 
period-name="Today">2007-08-31T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-08-31T18:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Tonight">2007-08-31T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-01T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Tomorrow">2007-09-01T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-01T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Tomorrow 
Night">2007-09-01T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-02T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Sunday">2007-09-02T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-02T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Sunday 
Night">2007-09-02T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-03T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Monday">2007-09-03T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-03T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Monday 
Night">2007-09-03T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-04T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Tuesday">2007-09-04T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-04T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Tuesday 
Night">2007-09-04T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-05T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Wednesday">2007-09-05T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-05T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Wednesday 
Night">2007-09-05T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-06T06:00:00-04:00</end-valid-time>
              <start-valid-time 
period-name="Thursday">2007-09-06T06:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-06T18:00:00-04:00</end-valid-time>
              <start-valid-time period-name="Thursday 
Night">2007-09-06T18:00:00-04:00</start-valid-time>
                  <end-valid-time>2007-09-07T06:00:00-04:00</end-valid-time>
      </time-layout>
      <parameters applicable-location="point1">
         <temperature type='maximum' units="Fahrenheit" 
time-layout="k-p24h-n7-1">
            <name>Daily Maximum Temperature</name>
            <value>85</value>
            <value>80</value>
            <value>83</value>
            <value>85</value>
            <value>86</value>
            <value>84</value>
            <value>84</value>
         </temperature>
         <temperature type='minimum' units="Fahrenheit" 
time-layout="k-p24h-n7-2">
            <name>Daily Minimum Temperature</name>
            <value>59</value>
            <value>57</value>
            <value>62</value>
            <value>67</value>
            <value>66</value>
            <value>66</value>
            <value xsi:nil="true" />
         </temperature>
         <probability-of-precipitation type='12 hour' units="percent" 
time-layout="k-p12h-n14-3">
            <name>12 Hourly Probability of Precipitation</name>
            <value>18</value>
            <value>14</value>
            <value>0</value>
            <value>0</value>
            <value>0</value>
            <value>0</value>
            <value>7</value>
            <value>9</value>
            <value>10</value>
            <value>14</value>
            <value>14</value>
            <value>20</value>
            <value>20</value>
            <value xsi:nil="true" />
         </probability-of-precipitation>
         <weather time-layout="k-p12h-n14-3">
            <name>Weather Type, Coverage, and Intensity</name>
            <weather-conditions xsi:nil="true" />
            <weather-conditions weather-summary="Mostly Clear">
            </weather-conditions>
            <weather-conditions weather-summary="Mostly Sunny">
            </weather-conditions>
            <weather-conditions weather-summary="Clear">
            </weather-conditions>
            <weather-conditions weather-summary="Sunny">
            </weather-conditions>
            <weather-conditions weather-summary="Clear">
            </weather-conditions>
            <weather-conditions weather-summary="Mostly Sunny">
            </weather-conditions>
            <weather-conditions weather-summary="Mostly Clear">
            </weather-conditions>
            <weather-conditions weather-summary="Mostly Sunny">
            </weather-conditions>
            <weather-conditions weather-summary="Mostly Clear">
            </weather-conditions>
            <weather-conditions weather-summary="Partly Cloudy">
            </weather-conditions>
            <weather-conditions weather-summary="Chance Rain Showers">
               <value coverage="slight chance" intensity="none" 
weather-type="thunderstorms" qualifier="none">
               </value>
               <value coverage="slight chance" intensity="light" additive="and" 
weather-type="rain showers" qualifier="none">
               </value>
            </weather-conditions>
            <weather-conditions weather-summary="Chance Rain Showers">
               <value coverage="slight chance" intensity="none" 
weather-type="thunderstorms" qualifier="none">
               </value>
               <value coverage="slight chance" intensity="light" additive="and" 
weather-type="rain showers" qualifier="none">
               </value>
            </weather-conditions>
            <weather-conditions xsi:nil="true" />
         </weather>
         <conditions-icon type="forecast-NWS" time-layout="k-p12h-n14-3">
            <name>Conditions Icons</name>
               <icon-link xsi:nil="true" />
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nfew.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nskc.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/skc.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nskc.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nfew.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nfew.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/sct.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/nra20.jpg</icon-link>
               
<icon-link>http://www.nws.noaa.gov/weather/images/fcicons/shra20.jpg</icon-link>
               <icon-link xsi:nil="true" />
         </conditions-icon>
      </parameters>
   </data>
</dwml>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to