Error ''doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.'
asp.net, c#, google-api
Solution
If your favourite weather app suddenly stopped working in the last week or so, there’s no point trying to refresh or reinstall it. Google has shut down its weather API without a word and stranded developers who relied on it to power their weather-related applications. What we’re left with is a pile of broken apps that may or may not get fixed.
It's gone my friend try something else
well you can get from here
http://www.yr.no/
http://www.weathercase.net/
MSN weather API list of conditions?
Thanks
Problem
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... .aspx file ``` <%@ Page Language="C#" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head id="Head1" runat="server"> <title>Put Your Title Here</title> <style type="text/css"> #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; } </style> </head> <body> <form id="form1" runat="server"> <h1 style="text-align:left">Using The Google Weather API</h1><br /> <div style="text-align:left"> <b>Enter Location (Postal Code or City): </b><asp:TextBox ID="txtLocation" Text="10007" runat="server"></asp:TextBox> <asp:Button ID="btnGo" runat="server" Text="GO" onclick="btnGo_Click" /><br /><br /> <asp:Panel ID="Panel1" runat="server"> <asp:Image ImageUrl="" runat="server" ID="icon" /> <br /> <p> Forecast for <b><asp:Label ID="lblLocation" runat="server"></asp:Label></b><br /> Current Condition: <b><asp:Label ID="currCondition" runat="server" Text=""></asp:Label></b><br /> <b><asp:Label ID="temp_f" runat="server" CssClass = "temp" Text=""></asp:Label></b> <b><asp:Label ID="temp_c" runat="server" Text=""></asp:Label></b><br /> <b><asp:Label ID="humidity" runat="server" Text=""></asp:Label></b><br /> <b><asp:Label ID="wind_condition" runat="server" Text=""></asp:Label></b><br /> Forecast Date: <b><asp:Label ID="lblForecastDate" runat="server" Text=""></asp:Label></b><br /> </p> </asp:Panel><br /> <div> <b><asp:Label id="wdcError" runat="server" Visible="false" CssClass="weatherError" ></asp:Label></b> </div> </div> </form> <br/> </body> </html> ``` .cs file ``` 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 + "°" + "F"; temp_c.Text = " (" + item.Element("temp_c").Attribute("data").Value + "°" + "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; } } ```