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

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

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

revision 310 by torben, Thu Sep 10 19:09:09 2009 UTC revision 319 by torben, Fri Sep 11 12:24:53 2009 UTC
# Line 30  public class XmlStationProvider implemen Line 30  public class XmlStationProvider implemen
30          }          }
31    
32          @Override          @Override
33          public void lookupStations(Location location) {          public boolean lookupStations(Location location) {
34                                    boolean success = false;
                 //String url = "http://pumba.t-hoerup.dk:8080/TrainInfoService/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude();  
35                  String url = "http://app.t-hoerup.dk/TrainInfoService/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude();                  String url = "http://app.t-hoerup.dk/TrainInfoService/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude();
36                  Log.i("url", url);                  Log.i("url", url);
37                  try {                  try {
# Line 64  public class XmlStationProvider implemen Line 63  public class XmlStationProvider implemen
63                                                                                    
64                                          String nodeName = current.getNodeName();                                          String nodeName = current.getNodeName();
65                                                                                    
                                         Log.i("XML", "" + nodeName + "=" + content);  
                                           
66                                          if (nodeName.equals("id"))                                          if (nodeName.equals("id"))
67                                                  station.setId( Integer.parseInt(content));                                                  station.setId( Integer.parseInt(content));
68                                                                                    
# Line 86  public class XmlStationProvider implemen Line 83  public class XmlStationProvider implemen
83    
84                                  }                                  }
85                                  stations.add(station);                                                            stations.add(station);                          
86                          }                                        }
87                            success = true;
88                                                    
89                                                    
90                  } catch (Exception e) {                  } catch (Exception e) {
91                          Log.e("XmlStationProvider", "lookupStations: ", e);                          Log.e("XmlStationProvider", "lookupStations: ", e);
92                  }                  }
93                    return success;
94          }          }
95    
96          public Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException          private Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException
97          {          {
98                  DocumentBuilder builder =  DocumentBuilderFactory.newInstance().newDocumentBuilder();                  DocumentBuilder builder =  DocumentBuilderFactory.newInstance().newDocumentBuilder();
99                  return  builder.parse( new ByteArrayInputStream(str.getBytes()) );                                return  builder.parse( new ByteArrayInputStream(str.getBytes()) );              

Legend:
Removed from v.310  
changed lines
  Added in v.319

  ViewVC Help
Powered by ViewVC 1.1.20