Skip to content

Commit

Permalink
Fix #64 Tutorial 1: MSN weather discontinued
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenEwald committed Sep 4, 2022
1 parent 7968714 commit bf6c89f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ public void getWeatherData() throws SAXException, IOException, ParserConfigurati
// START SNIPPET: WeatherDataCode
private void printWeatherData(String location) throws IOException {

final String BaseURL = "http://weather.service.msn.com/find.aspx?outputview=search&weasearchstr=";
// The weather service was discontinued. Changed to read from file.
//final String BaseURL = "http://weather.service.msn.com/find.aspx?outputview=search&weasearchstr=";
final String fileURL = "resource://WeatherData.xml";

// We let the projector fetch the data for us
WeatherData weatherData = new XBProjector().io().url(BaseURL + location).read(WeatherData.class);
WeatherData weatherData = new XBProjector().io().url(fileURL).read(WeatherData.class);

// Print some values
System.out.println("The weather in " + weatherData.getLocation() + ":");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><weatherdata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><weather weatherlocationcode="wc:8172902" weatherlocationname="Monschau, DEU" zipcode="" weatherfullname="Monschau, North Rhine-Westphalia, Germany" searchlocation="Monschau, Stadt Aachen, NW, Germany" searchdistance="0" searchscore="0.95" url="http://local.msn.com/worldweather.aspx?eid=8172902&amp;q=Monschau-DEU" imagerelativeurl="http://wst.s-msn.com/i/en-us/" degreetype="F" provider="Foreca" isregion="False" region="" alert="" searchresult="Monschau, North Rhine-Westphalia, Germany" lat="50.5567016601563" lon="6.23998022079468" entityid="8172902"><current temperature="61" skycode="27" skytext="Mostly Cloudy" /></weather><weather weatherlocationcode="wc:USMS0400" weatherlocationname="Tupelo, MS" zipcode="38804" weatherfullname="Tupelo, Mississippi" searchlocation="Park Monceau, Lee, MS, United States" searchdistance="2.12943197619049" searchscore="0.95" url="http://local.msn.com/weather.aspx?eid=34150&amp;q=Tupelo-MS&amp;zip=38804" imagerelativeurl="http://wst.s-msn.com/i/en-us/" degreetype="F" provider="iMap" isregion="False" region="" alert="" searchresult="Park Monceau, Lee, MS, United States (closest location: Tupelo, MS)" lat="34.2946014404297" lon="-88.7228012084961" entityid="34150"><current temperature="68" skycode="28" skytext="Mostly Cloudy" /></weather></weatherdata>

0 comments on commit bf6c89f

Please sign in to comment.