if (elDesc != null) {
strDesc = elDesc.getTextTrim();
}
// generate new RSS item (link to article)
ItemIF rssItem = cBuilder.createItem(item, chnl, strTitle, strDesc,
ParserUtils.getURL(strLink));
rssItem.setFound(dateParsed);
// get creator element
Element elCreator = item.getChild("creator", dcNS);
if (elCreator != null) {
rssItem.setCreator(elCreator.getTextTrim());
}
// get subject element
Element elSubject = item.getChild("subject", dcNS);
if (elSubject != null) {
// TODO: Mulitple subject elements not handled currently
rssItem.setSubject(elSubject.getTextTrim());
}
// get date element
Element elDate = item.getChild("date", dcNS);
if (elDate != null) {
rssItem.setDate(ParserUtils.getDate(elDate.getTextTrim()));
}
// get source element - default to Aggregation module, then try Dublin Core
String sourceName = null;
String sourceLocation = null;
Date sourceTimestamp = null;
Element elSourceURL = item.getChild("sourceURL", agNS);
if (elSourceURL == null) { // No Aggregation module - try Dublin Core
elSourceURL = item.getChild("source", dcNS);
if (elSourceURL != null) {
sourceLocation = elSourceURL.getTextTrim();
sourceName = "Source";
}
} else { // Aggregation module
sourceLocation = elSourceURL.getTextTrim();
Element elSourceName = item.getChild("source", agNS);
if (elSourceName != null) {
sourceName = elSourceName.getTextTrim();
}
Element elSourceTimestamp = item.getChild("timestamp", agNS);
if (elSourceTimestamp != null) {
sourceTimestamp = ParserUtils
.getDate(elSourceTimestamp.getTextTrim());
}
}
if (sourceLocation != null) {
ItemSourceIF itemSource = cBuilder.createItemSource(rssItem,
sourceName, sourceLocation, sourceTimestamp);
rssItem.setSource(itemSource);
}
// comments element - use Annotation module
Element elReference = item.getChild("reference", annotateNS);
if (elReference != null) {
Attribute resource = elReference.getAttribute("resource", ParserUtils
.getNamespace(elReference, "rdf"));
if (resource != null) {
URL resourceURL = ParserUtils.getURL(resource.getValue());
if (resourceURL != null) {
rssItem.setComments(resourceURL);
}
}
}
}