Element itemsElem = new Element("items", defNs);
Element seqElem = new Element("Seq", rdfNs);
Collection items = channel.getItems();
Iterator it = items.iterator();
while (it.hasNext()) {
ItemIF item = (ItemIF) it.next();
Element itemElem = new Element("li", rdfNs);
if (item.getLink() != null) {
itemElem.setAttribute("resource", item.getLink().toString());
}
seqElem.addContent(itemElem);
}
itemsElem.addContent(seqElem);
channelElem.addContent(itemsElem);
rootElem.addContent(channelElem);
// item-by-item en detail
items = channel.getItems();
it = items.iterator();
while (it.hasNext()) {
ItemIF item = (ItemIF) it.next();
Element itemElem = new Element("item", defNs);
if (item.getLink() != null) {
itemElem.setAttribute("about",
item.getLink().toString(), rdfNs);
}
itemElem.addContent(new Element("title", defNs).setText(item.getTitle()));
if (item.getLink() != null) {
itemElem.addContent(new Element("link", defNs)
.setText(item.getLink().toString()));
}
if (item.getDescription() != null) {
itemElem.addContent(new Element("description", dcNs)
.setText(item.getDescription()));
}
if (item.getDate() != null) {
itemElem.addContent(new Element("date", dcNs)
.setText(ParserUtils.formatDate(item.getDate())));
}
rootElem.addContent(itemElem);
}