processItem(child, feed);
}
}
private void processItem(Element element, IFeed feed) {
INews news = Owl.getModelFactory().createNews(null, feed, new Date(System.currentTimeMillis() - (fNewsCounter++ * 1)));
String baseUrl = feed.getHomepage() != null ? feed.getHomepage().toString() : ""; //$NON-NLS-1$
/* Interpret Attributes */
List< ? > itemAttributes = element.getAttributes();
for (Iterator< ? > iter = itemAttributes.iterator(); iter.hasNext();) {
Attribute attribute = (Attribute) iter.next();
String name = attribute.getName().toLowerCase();
/* Check wether this Attribute is to be processed by a Contribution */
if (processAttributeExtern(attribute, news))
continue;
/* Last Modificated */
else if ("lastmod".equals(name)) //$NON-NLS-1$
news.setPublishDate(DateUtils.parseDate(attribute.getValue()));
/* Href - Append with Feed-Base */
else if ("href".equals(name)) { //$NON-NLS-1$
URI uri = URIUtils.createURI(baseUrl + attribute.getValue());
if (uri != null)
news.setLink(uri);
}
}
/* Interpret Children */
List< ? > newsChilds = element.getChildren();
for (Iterator< ? > iter = newsChilds.iterator(); iter.hasNext();) {
Element child = (Element) iter.next();
String name = child.getName().toLowerCase();
/* Check wether this Element is to be processed by a Contribution */
if (processElementExtern(child, news))
continue;
/* Title */
else if ("title".equals(name)) { //$NON-NLS-1$
news.setTitle(child.getText());
processNamespaceAttributes(child, news);
}
/* Abstract */
else if ("abstract".equals(name)) { //$NON-NLS-1$
news.setDescription(child.getText());
processNamespaceAttributes(child, news);
}
}
}