/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureServlet.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureServlet.java

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

revision 977 by torben, Fri Jul 9 21:02:13 2010 UTC revision 978 by torben, Sat Jul 10 10:53:44 2010 UTC
# Line 1  Line 1 
1  package dk.thoerup.traininfoservice.banedk;  package dk.thoerup.traininfoservice.banedk;
2    
3  import java.io.IOException;  import java.io.IOException;
 import java.util.List;  
4  import java.util.logging.Level;  import java.util.logging.Level;
5  import java.util.logging.Logger;  import java.util.logging.Logger;
6    
# Line 67  public class DepartureServlet extends Ht Line 66  public class DepartureServlet extends Ht
66                  int station = Integer.parseInt( req.getParameter("station") );                  int station = Integer.parseInt( req.getParameter("station") );
67                  String format = req.getParameter("format");                  String format = req.getParameter("format");
68    
69                  List<DepartureBean> beans;                  DepartureBean beans;
70    
71                  String stationName = StationDAO.getStationName(station);                  String stationName = StationDAO.getStationName(station);
72    
# Line 112  public class DepartureServlet extends Ht Line 111  public class DepartureServlet extends Ht
111    
112          }          }
113    
114          protected String formatXml(List<DepartureBean> beans, String stationName, boolean arrival) throws ServletException{          protected String formatXml(DepartureBean beans, String stationName, boolean arrival) throws ServletException{
115                  String xml = "";                  String xml = "";
116                  try {                  try {
117                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
# Line 123  public class DepartureServlet extends Ht Line 122  public class DepartureServlet extends Ht
122                  Element root = doc.createElement("departureinfo");                  Element root = doc.createElement("departureinfo");
123                  root.setAttribute("station", stationName);                  root.setAttribute("station", stationName);
124                  root.setAttribute("arrival", Boolean.toString(arrival) );                  root.setAttribute("arrival", Boolean.toString(arrival) );
125                  for (DepartureBean departure : beans) {                  
126                    for (String notif : beans.notifications) {
127                            Element notElem = doc.createElement("notification");
128                            notElem.setTextContent(notif);
129                            root.appendChild(notElem);
130                    }
131                    
132                    for (DepartureEntry departure : beans.departureEntries) {
133                          Element train = doc.createElement("train");                          Element train = doc.createElement("train");
134                                                    
135                          Element time = doc.createElement("time");                          Element time = doc.createElement("time");

Legend:
Removed from v.977  
changed lines
  Added in v.978

  ViewVC Help
Powered by ViewVC 1.1.20