/[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 968 by torben, Mon Jul 5 09:48:06 2010 UTC revision 969 by torben, Fri Jul 9 21:02:13 2010 UTC
# Line 95  public class DepartureServlet extends Ht Line 95  public class DepartureServlet extends Ht
95                                    
96                  if (format.equalsIgnoreCase("xml")) {                  if (format.equalsIgnoreCase("xml")) {
97                          resp.setContentType("text/xml");                          resp.setContentType("text/xml");
98                          resp.getWriter().print( formatXml(beans, stationName) );                          resp.getWriter().print( formatXml(beans, stationName, arrival) );
99                  } else if (format.equalsIgnoreCase("html")) {                  } else if (format.equalsIgnoreCase("html")) {
100                                                    
101                          String advStr = req.getParameter("advanced");                          String advStr = req.getParameter("advanced");
# Line 112  public class DepartureServlet extends Ht Line 112  public class DepartureServlet extends Ht
112    
113          }          }
114    
115          protected String formatXml(List<DepartureBean> beans, String stationName) throws ServletException{          protected String formatXml(List<DepartureBean> beans, String stationName, boolean arrival) throws ServletException{
116                  String xml = "";                  String xml = "";
117                  try {                  try {
118                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
# Line 122  public class DepartureServlet extends Ht Line 122  public class DepartureServlet extends Ht
122                          Document doc = impl.createDocument(null,null,null);                          Document doc = impl.createDocument(null,null,null);
123                  Element root = doc.createElement("departureinfo");                  Element root = doc.createElement("departureinfo");
124                  root.setAttribute("station", stationName);                  root.setAttribute("station", stationName);
125                    root.setAttribute("arrival", Boolean.toString(arrival) );
126                  for (DepartureBean departure : beans) {                  for (DepartureBean departure : beans) {
127                          Element train = doc.createElement("train");                          Element train = doc.createElement("train");
128                                                    

Legend:
Removed from v.968  
changed lines
  Added in v.969

  ViewVC Help
Powered by ViewVC 1.1.20