public Element toXml(Document document) { final Element name = getName().toXml(document); final Element element = DomUtils.createElement( document, ELEMENT_CARDDAV_ADDRESS_DATA_TYPE, carddav(ELEMENT_CARDDAV_ADDRESS_DATA_TYPE)); DomUtils.setAttribute( element, ATTR_CALDAV_CONTENT_TYPE, carddav(ATTR_CALDAV_CONTENT_TYPE), CARD_MEDIA_TYPE); DomUtils.setAttribute(element, ATTR_CALDAV_VERSION, carddav(ATTR_CALDAV_VERSION), CARD_VERSION); name.appendChild(element); return name; }
/** * Construct a CalendarFilter object from a DOM Element. * * @param element The element. * @param timezone The timezone. * @throws ParseException - if something is wrong this exception is thrown. */ public CalendarFilter(Element element, VTimeZone timezone) throws ParseException { // Can only have a single comp-filter element final ElementIterator i = DomUtils.getChildren(element, CarldavConstants.c(ELEMENT_CALDAV_COMP_FILTER)); if (!i.hasNext()) { throw new ParseException("CALDAV:filter must contain a comp-filter", -1); } final Element child = i.nextElement(); if (i.hasNext()) { throw new ParseException("CALDAV:filter can contain only one comp-filter", -1); } // Create new component filter and have it parse the element filter = new ComponentFilter(child, timezone); }