/** * Sets the content for this entry */ public Content setContent(String value, Content.Type type) { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(type); content.setValue(value); setContentElement(content); return content; }
protected void setEntryContent(Factory factory, Entry e, String content) { Content ct = factory.newContent(Content.Type.XML); ct.setValue(content); e.setContentElement(ct); }
protected void setEntryContent(Factory factory, Entry e, String content) { Content ct = factory.newContent(Content.Type.XML); ct.setValue(content); e.setContentElement(ct); }
protected void setEntryContent(Factory factory, Entry e, String content) { Content ct = factory.newContent(Content.Type.XML); ct.setValue(content); e.setContentElement(ct); }
/** * Sets the content for this entry as @type="text" */ public Content setContent(String value) { complete(); FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(); content.setValue(value); setContentElement(content); return content; }
/** * Sets the content for this entry * * @throws MimeTypeParseException */ public Content setContent(String value, String mediatype) { try { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(new MimeType(mediatype)); content.setValue(value); content.setMimeType(mediatype); setContentElement(content); return content; } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } }
private Entry createBookEntry(int id, String name) throws Exception { Book b = new Book(); b.setId(id); b.setName(name); Factory factory = Abdera.getNewFactory(); JAXBContext jc = JAXBContext.newInstance(Book.class); Entry e = factory.getAbdera().newEntry(); e.setTitle(b.getName()); e.setId(Long.toString(b.getId())); StringWriter writer = new StringWriter(); jc.createMarshaller().marshal(b, writer); Content ct = factory.newContent(Content.Type.XML); ct.setValue(writer.toString()); e.setContentElement(ct); return e; }