{
Entry e = (Entry)i.next();
WikiPage p = e.getPage();
Element entryEl = getElement("entry");
//
// Mandatory elements
//
entryEl.addContent( getElement("id").setText( getEntryID(e)) );
entryEl.addContent( getElement("title").setAttribute("type","html").setText( e.getTitle() ));
entryEl.addContent( getElement("updated").setText( DateFormatUtils.formatUTC(p.getLastModified(),
RFC3339FORMAT )));
//
// Optional elements
//
entryEl.addContent( getElement("author").addContent( getElement("name").setText( e.getAuthor() )));
entryEl.addContent( getElement("link").setAttribute("rel","alternate").setAttribute("href",e.getURL()));
entryEl.addContent( getElement("content").setAttribute("type","html").setText( e.getContent() ));
//
// Check for enclosures
//
if( engine.getAttachmentManager().hasAttachments(p) && servletContext != null )
{
try
{
Collection c = engine.getAttachmentManager().listAttachments(p);
for( Iterator a = c.iterator(); a.hasNext(); )
{
Attachment att = (Attachment) a.next();
Element attEl = getElement("link");
attEl.setAttribute( "rel","enclosure" );
attEl.setAttribute( "href", engine.getURL(WikiContext.ATTACH, att.getName(), null, true ) );
attEl.setAttribute( "length", Long.toString(att.getSize()) );
attEl.setAttribute( "type", getMimeType( servletContext, att.getFileName() ) );
entryEl.addContent( attEl );
}
}
catch( ProviderException ex )