/** * Gets the first child element with the given data type. * * @param dataType the data type * @return the child element or null if not found */ public XCalElement child(ICalDataType dataType) { String localName = dataType.getName().toLowerCase(); for (Element child : children()) { if (localName.equals(child.getLocalName()) && XCAL_NS.equals(child.getNamespaceURI())) { return new XCalElement(child); } } return null; }
/** * Gets all child elements with the given data type. * * @param dataType the data type * @return the child elements */ public List<XCalElement> children(ICalDataType dataType) { String localName = dataType.getName().toLowerCase(); List<XCalElement> children = new ArrayList<XCalElement>(); for (Element child : children()) { if (localName.equals(child.getLocalName()) && XCAL_NS.equals(child.getNamespaceURI())) { children.add(new XCalElement(child)); } } return children; }
private String toLocalName(ICalDataType dataType) { return (dataType == null) ? "unknown" : dataType.getName().toLowerCase(); }
/** * Adds an empty value. * * @param dataType the data type * @return the created element */ public XCalElement append(ICalDataType dataType) { return append(dataType.getName().toLowerCase()); }