Element root = document.addElement("root");
Element appointments = root.addElement("appointments");
for (Iterator<Appointment> it = aList.iterator();it.hasNext();) {
Appointment a = it.next();
Element appointment = appointments.addElement("appointment");
appointment.addElement("appointmentId").addCDATA(""+a.getAppointmentId());
appointment.addElement("appointmentName").addCDATA(""+a.getAppointmentName());
appointment.addElement("appointmentLocation").addCDATA(""+a.getAppointmentLocation());
appointment.addElement("appointmentDescription").addCDATA(""+a.getAppointmentDescription());
appointment.addElement("appointmentStarttime").addCDATA(CalendarPatterns.getDateWithTimeByMiliSeconds(a.getAppointmentStarttime()));
appointment.addElement("appointmentEndtime").addCDATA(CalendarPatterns.getDateWithTimeByMiliSeconds(a.getAppointmentEndtime()));
if (a.getAppointmentCategory() != null) {
appointment.addElement("categoryId").addCDATA(""+a.getAppointmentCategory().getCategoryId());
} else {
appointment.addElement("categoryId").addCDATA(""+0);
}
if (a.getUserId() != null) {
appointment.addElement("users_id").addCDATA(""+a.getUserId().getUser_id());
} else {
appointment.addElement("users_id").addCDATA(""+0);
}
appointment.addElement("deleted").addCDATA(""+a.getDeleted());
appointment.addElement("comment").addCDATA(""+a.getComment());
if (a.getRemind() != null) {
appointment.addElement("typId").addCDATA(""+a.getRemind().getTypId());
} else {
appointment.addElement("typId").addCDATA(""+0);
}
appointment.addElement("isDaily").addCDATA(""+a.getIsDaily());
appointment.addElement("isWeekly").addCDATA(""+a.getIsWeekly());
appointment.addElement("isMonthly").addCDATA(""+a.getIsMonthly());
appointment.addElement("isYearly").addCDATA(""+a.getIsYearly());
if (a.getRoom() != null) {
appointment.addElement("room_id").addCDATA(""+a.getRoom().getRooms_id());
} else {
appointment.addElement("room_id").addCDATA(""+0);
}
appointment.addElement("icalId").addCDATA(""+a.getIcalId());
appointment.addElement("language_id").addCDATA(""+a.getLanguage_id());
appointment.addElement("isPasswordProtected").addCDATA(""+a.getIsPasswordProtected());
appointment.addElement("password").addCDATA(""+a.getPassword());
//Separated XML File
// Element meetingMembers = appointment.addElement("meetingMembers");
// //List<String> organisations = new LinkedList();