/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlDepartureProvider.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlDepartureProvider.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 238 by torben, Sat Aug 8 20:09:47 2009 UTC revision 294 by torben, Tue Sep 1 20:28:55 2009 UTC
# Line 26  public class XmlDepartureProvider extend Line 26  public class XmlDepartureProvider extend
26          StringBuilder builder = new StringBuilder(512);          StringBuilder builder = new StringBuilder(512);
27                    
28          @Override          @Override
29          public void lookupDepartures(String station) {          public void lookupDepartures(String stationCode) {
30                  departures.clear();                  departures.clear();
31                  try                  try
32                  {       String url = "http://t-hoerup.dk/tog/xml_display.php?stationname="+station;                  {      
33                          String doc =  DownloadUtil.getContent(url, 30000, "ISO-8859-1");                          String url = "http://t-hoerup.dk/tog/xml_display.php?stationcode="+stationCode;
34                            Log.i("xmlurl",url);
35                            String doc =  DownloadUtil.getContentString(url, 45000, "ISO-8859-1");
36                                                    
37                          InputSource source = new InputSource( new StringReader(doc));                          InputSource source = new InputSource( new StringReader(doc));
38                                                    
# Line 75  public class XmlDepartureProvider extend Line 77  public class XmlDepartureProvider extend
77                  if (name.equals("train")) {                  if (name.equals("train")) {
78                          departures.add( tempDeparture );                          departures.add( tempDeparture );
79                  } else if (name.equals("time")) {                  } else if (name.equals("time")) {
80                          tempDeparture.setTime(builder.toString());                          tempDeparture.setTime(builder.toString().trim());
81                  } else if (name.equals("updated")) {                  } else if (name.equals("updated")) {
82                          tempDeparture.setLastUpdate(builder.toString());                          tempDeparture.setLastUpdate(builder.toString().trim());
83                  } else if (name.equals("trainnumber")) {                  } else if (name.equals("trainnumber")) {
84                          tempDeparture.setTrainNumber(builder.toString());                          tempDeparture.setTrainNumber(builder.toString().trim());
85                  } else if (name.equals("destination")) {                  } else if (name.equals("destination")) {
86                          tempDeparture.setDestination(builder.toString());                          tempDeparture.setDestination(builder.toString().trim());
87                  } else if (name.equals("origin")) {                  } else if (name.equals("origin")) {
88                          tempDeparture.setOrigin(builder.toString());                          tempDeparture.setOrigin(builder.toString().trim());
89                  } else if (name.equals("location")) {                  } else if (name.equals("location")) {
90                          tempDeparture.setLocation(builder.toString());                          tempDeparture.setLocation(builder.toString().trim());
91                  } else if (name.equals("status")) {                  } else if (name.equals("status")) {
92                          tempDeparture.setStatus(builder.toString());                          tempDeparture.setStatus(builder.toString().trim());
93                  } else if (name.equals("note")) {                  } else if (name.equals("note")) {
94                          tempDeparture.setNote(builder.toString());                          tempDeparture.setNote(builder.toString().trim());
95                  }                  }
96          }          }
97  }  }

Legend:
Removed from v.238  
changed lines
  Added in v.294

  ViewVC Help
Powered by ViewVC 1.1.20