@Override protected ExceptionDates _parseXml( XCalElement element, ICalParameters parameters, ParseContext context) { List<String> dateTimeElements = element.all(DATE_TIME); List<String> dateElements = element.all(DATE); if (dateTimeElements.isEmpty() && dateElements.isEmpty()) { throw missingXmlElements(DATE_TIME, DATE); } ExceptionDates property = new ExceptionDates(); for (String value : dateTimeElements) { ICalDate datetime = readValue(property, value, DATE_TIME, parameters, context); property.addValue(datetime); } for (String value : dateElements) { ICalDate date = readValue(property, value, DATE, parameters, context); property.addValue(date); } return property; }
@Override protected void _writeXml(ExceptionDates property, XCalElement element, WriteContext context) { List<ICalDate> values = property.getValues(); if (values.isEmpty()) { element.append(defaultDataType(context.getVersion()), ""); return; } if (isInObservance(context)) { for (ICalDate value : values) { String valueStr = date(value).observance(true).extended(true).write(); element.append(DATE_TIME, valueStr); } return; } for (ICalDate value : values) { ICalDataType dataType = value.hasTime() ? DATE_TIME : DATE; String dateStr = date(value, property, context).extended(true).write(); element.append(dataType, dateStr); } }