title: Error ''doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.'
body: <p>hey everyone i am new to using google api get weather update. problem its gives an error..
  i set the doctype but problem not solved.. please help me thanks in advance...</p>
  
  <p>.aspx file</p>
  
  <pre><code>&lt;%@ Page Language="C#"  CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
  &lt;head id="Head1" runat="server"&gt;
      &lt;title&gt;Put Your Title Here&lt;/title&gt;
      &lt;style type="text/css"&gt;
          #Panel1
          {        
              width:350px;         
          }           
          #Panel1 img
          {
              float:left;
              width:100px;
              height:100px;
              margin-top:10px;
          }
          #Panel1 p
          {        
              float:right;
              margin-top:-10px;
              margin-right:0px;        
          }
          #Panel1 legend
          {        
              background-color:Green;
              color:White;
          }
      &lt;/style&gt; 
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;h1 style="text-align:left"&gt;Using The Google Weather API&lt;/h1&gt;&lt;br /&gt; 
          &lt;div style="text-align:left"&gt;
              &lt;b&gt;Enter Location (Postal Code or City): &lt;/b&gt;&lt;asp:TextBox ID="txtLocation" Text="10007" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;asp:Button ID="btnGo" runat="server" Text="GO" onclick="btnGo_Click" /&gt;&lt;br /&gt;&lt;br /&gt;
  
              &lt;asp:Panel ID="Panel1" runat="server"&gt;
                  &lt;asp:Image ImageUrl="" runat="server" ID="icon" /&gt; &lt;br /&gt;
                  &lt;p&gt;
                      Forecast for &lt;b&gt;&lt;asp:Label ID="lblLocation" runat="server"&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                      Current Condition: &lt;b&gt;&lt;asp:Label ID="currCondition" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                      &lt;b&gt;&lt;asp:Label ID="temp_f" runat="server" CssClass = "temp" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;
                      &lt;b&gt;&lt;asp:Label ID="temp_c" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                      &lt;b&gt;&lt;asp:Label ID="humidity" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                      &lt;b&gt;&lt;asp:Label ID="wind_condition" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                      Forecast Date: &lt;b&gt;&lt;asp:Label ID="lblForecastDate" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/b&gt;&lt;br /&gt;
                  &lt;/p&gt;
              &lt;/asp:Panel&gt;&lt;br /&gt;
                  &lt;div&gt;
                      &lt;b&gt;&lt;asp:Label id="wdcError" runat="server" Visible="false" CssClass="weatherError" &gt;&lt;/asp:Label&gt;&lt;/b&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;br/&gt;       
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>.cs file</p>
  
  <pre><code>  protected void btnGo_Click(object sender, EventArgs e)
          {
              // retrieve weather for the zip code entered by the user
              getWeatherData();
          }
  
          public void getWeatherData()
          {
              wdcError.Visible = false;
  
              // check for empty zip code field
              if (txtLocation.Text.Length == 0)
              {
                  wdcError.Visible = true;
                  wdcError.Text = "Please enter a location!";
                  return;
              }
              // load xml result from Google weather
              XDocument xd = XDocument.Load("http://www.google.com/ig/api?weather=" + txtLocation.Text);
  
              // used to determine if a node is missing
              int cnt = 0;
              cnt = xd.Descendants("forecast_information").Count();
  
              // determine if forecast information was returned for the location entered by user
              if (cnt == 0)
              {
                  wdcError.Visible = true;
                  wdcError.Text = "Forecast Information NOT available for the location";
                  return;
              }
  
              // navigate to the Current Conditions node
              var current_conditions = from currentCond in xd.Root.Descendants("current_conditions")
                                       select currentCond;
  
              // navigate to the Forecast Information node
              var forcastInfo = from forecastinfo in xd.Root.Descendants("forecast_information")
                                select forecastinfo;
  
              Panel1.GroupingText = "Today's Weather";
  
              // retrieve city and forecast date information
              foreach (var item in forcastInfo)
              {
                  lblLocation.Text = item.Element("city").Attribute("data").Value;
                  lblForecastDate.Text = item.Element("forecast_date").Attribute("data").Value;
              }
  
              // retrieve current weather conditions information
              foreach (var item in current_conditions)
              {
                  currCondition.Text = item.Element("condition").Attribute("data").Value;
                  temp_f.Text = item.Element("temp_f").Attribute("data").Value + "&amp;deg;" + "F";
                  temp_c.Text = "  (" + item.Element("temp_c").Attribute("data").Value + "&amp;deg;" + "C" + ")";
                  humidity.Text = item.Element("humidity").Attribute("data").Value;
                  icon.ImageUrl = "http://www.google.com" + item.Element("icon").Attribute("data").Value;
                  wind_condition.Text = item.Element("wind_condition").Attribute("data").Value;
              }
          }
  </code></pre>