return dayPart;
}
private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendar businessCalendar, Parse parse) {
Holiday holiday = new Holiday();
try {
if (holidayElement.hasAttribute("date")) {
String holidayText = holidayElement.getAttribute("date");
Date holidayDate = dayFormat.parse(holidayText.trim());
holiday.setToDay(holidayDate);
holiday.setFromDay(holidayDate);
} else if ( (holidayElement.hasAttribute("from"))
&& (holidayElement.hasAttribute("to"))
) {
String dayText = holidayElement.getAttribute("from");
Date dayDate = dayFormat.parse(dayText.trim());
holiday.setFromDay(dayDate);
dayText = holidayElement.getAttribute("to");
dayDate = dayFormat.parse(dayText.trim());
holiday.setToDay(dayDate);
}
// now we are going to set the toDay to the end of the day, rather then the beginning.
// we take the start of the next day as the end of the toDay.
Calendar calendar = businessCalendar.createCalendar();
calendar.setTime(holiday.getToDay());
calendar.add(Calendar.DATE, 1);
Date toDay = calendar.getTime();
holiday.setToDay(toDay);
} catch (Exception e) {
parse.addProblem("couldn't parse holiday: "+XmlUtil.toString(holidayElement));
}