Problem in yahoo weather
Hello Expert ,
I am getting this error on get yahoo weather :
If you know the solution for this error please suggest me.@
Execution error in service script [WeatherThing GetWeather] : Wrapped org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 429; The content of elements must consist of well-formed character data or markup. Cause: The content of elements must consist of well-formed character data or markup.
Code :
var stringLocation=location+" ";
var arrayLocations=stringLocation.split(",");
var lat=arrayLocations[0];
var long=arrayLocations[1];
//Modify the open weather url here if you are using your own API key
var params = {
url: "http://api.openweathermap.org/data/2.5/forecast?lat="+lat+"&lon="+long+ "&units=imperial" +"&type=accurate&mode=xml&APPID=4abc8a3c9f101ccf9c7cfe7cbf3dfed7" /* STRING */,
timeout: 60 /* NUMBER */
};
// result: XML
var xmlPage = Resources["ContentLoaderFunctions"].LoadXML(params); // Error Generate on This line
var params = {
infoTableName : "InfoTable",
dataShapeName : "OpenWeatherFeed"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(YahooWeatherFeed)
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var from_today_value=xmlPage.forecast.time[0].@from.substring(0,10);
logger.warn("from_today_value= "+from_today_value);
for each (var item in xmlPage.forecast.time) {
var row = new Object();
var from_current_value=item.@from.substring(0,10);
if(from_current_value!=from_today_value){
row.WindDirection = item.windDirection.@name;
row.WindSpeed=item.windSpeed.@mps;
row.WeatherTemp=parseFloat(item.temperature.@value);
row.WeatherHumidity=parseFloat(item.humidity.@value);
row.From=item.@from;
row.To=item.@to;
row.Title=xmlPage.location.name+" "+xmlPage.location.country;
row.Precipitation=(item.precipitation.@type+" "+item.precipitation.@value)==" "?"No Precipitation":item.precipitation.@type;
result.AddRow(row);
}
}
Thanks ,
Mayank
