本文整理汇总了Java中com.sun.syndication.feed.atom.Entry类的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entry类属于com.sun.syndication.feed.atom包,在下文中一共展示了Entry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseLink
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private Link parseLink(Feed feed , Entry entry, URL baseURI, Element eLink) {
Link link = new Link();
String att = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
if (att!=null) {
link.setRel(att);
}
att = eLink.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
if (att!=null) {
link.setType(att);
}
att = eLink.getAttributeValue("href");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
if (att!=null) {
if (isRelativeURI(att)) { //
link.setHref(resolveURI(baseURI, eLink, ""));
} else {
link.setHref(att);
}
}
att = eLink.getAttributeValue("hreflang");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
if (att!=null) {
link.setHreflang(att);
}
att = eLink.getAttributeValue("length");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
if (att!=null) {
link.setLength(Long.parseLong(att));
}
return link;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:Atom10Parser.java
示例2: parseEntry
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
/**
* Parse entry from reader.
*/
public static Entry parseEntry(Reader rd, String baseURI)
throws JDOMException, IOException, IllegalArgumentException, FeedException {
// Parse entry into JDOM tree
SAXBuilder builder = new SAXBuilder();
Document entryDoc = builder.build(rd);
Element fetchedEntryElement = entryDoc.getRootElement();
fetchedEntryElement.detach();
// Put entry into a JDOM document with 'feed' root so that Rome can handle it
Feed feed = new Feed();
feed.setFeedType("atom_1.0");
WireFeedOutput wireFeedOutput = new WireFeedOutput();
Document feedDoc = wireFeedOutput.outputJDom(feed);
feedDoc.getRootElement().addContent(fetchedEntryElement);
if (baseURI != null) {
feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
}
WireFeedInput input = new WireFeedInput();
Feed parsedFeed = (Feed)input.build(feedDoc);
return (Entry)parsedFeed.getEntries().get(0);
}
开发者ID:4thline,项目名称:feeds,代码行数:27,代码来源:Atom10Parser.java
示例3: serializeEntry
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
/**
* Utility method to serialize an entry to writer.
*/
public static void serializeEntry(Entry entry, Writer writer)
throws IllegalArgumentException, FeedException, IOException {
// Build a feed containing only the entry
List entries = new ArrayList();
entries.add(entry);
Feed feed1 = new Feed();
feed1.setFeedType("atom_1.0");
feed1.setEntries(entries);
// Get Rome to output feed as a JDOM document
WireFeedOutput wireFeedOutput = new WireFeedOutput();
Document feedDoc = wireFeedOutput.outputJDom(feed1);
// Grab entry element from feed and get JDOM to serialize it
Element entryElement= (Element)feedDoc.getRootElement().getChildren().get(0);
XMLOutputter outputter = new XMLOutputter();
outputter.output(entryElement, writer);
}
开发者ID:4thline,项目名称:feeds,代码行数:24,代码来源:Atom10Generator.java
示例4: buildFeedEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(
Map<String, Object> model,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
@SuppressWarnings("unchecked")
List<Spittle> spittles = (List<Spittle>) model.get("spittles");
List<Entry> entries = new ArrayList<Entry>();
for (Spittle spittle : spittles) {
Entry entry = new Entry();
entry.setTitle(spittle.getText());
entry.setCreated(spittle.getWhen());
entry.setAuthors(asList(spittle.getSpitter().getFullName()));
entries.add(entry);
}
return entries;
}
开发者ID:liuxianqiang,项目名称:spring-in-action,代码行数:20,代码来源:SpittlesAtomView.java
示例5: read
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
@Test
public void read() throws IOException {
InputStream is = getClass().getResourceAsStream("atom.xml");
MockHttpInputMessage inputMessage = new MockHttpInputMessage(is);
inputMessage.getHeaders().setContentType(new MediaType("application", "atom+xml", utf8));
Feed result = converter.read(Feed.class, inputMessage);
assertEquals("title", result.getTitle());
assertEquals("subtitle", result.getSubtitle().getValue());
List<?> entries = result.getEntries();
assertEquals(2, entries.size());
Entry entry1 = (Entry) entries.get(0);
assertEquals("id1", entry1.getId());
assertEquals("title1", entry1.getTitle());
Entry entry2 = (Entry) entries.get(1);
assertEquals("id2", entry2.getId());
assertEquals("title2", entry2.getTitle());
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:AtomFeedHttpMessageConverterTests.java
示例6: createSyndEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected List createSyndEntries(Feed feed, List atomEntries) {
List syndEntries = new ArrayList();
for (int i=0;i<atomEntries.size();i++) {
syndEntries.add(createSyndEntry(feed, (Entry) atomEntries.get(i)));
}
return syndEntries;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:ConverterForAtom10.java
示例7: createSyndLink
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
public SyndLink createSyndLink(Feed feed, Entry entry, Link link) {
SyndLink syndLink = new SyndLinkImpl();
syndLink.setRel(link.getRel());
syndLink.setType(link.getType());
syndLink.setHref(link.getHref());
syndLink.setHreflang(link.getHreflang());
syndLink.setLength(link.getLength());
return syndLink;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:ConverterForAtom10.java
示例8: createSyndEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected List createSyndEntries(List atomEntries) {
List syndEntries = new ArrayList();
for (int i=0;i<atomEntries.size();i++) {
syndEntries.add(createSyndEntry((Entry) atomEntries.get(i)));
}
return syndEntries;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:ConverterForAtom03.java
示例9: parseAlternateLinks
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private List parseAlternateLinks(Feed feed, Entry entry, URL baseURI, List eLinks) {
List links = new ArrayList();
for (int i=0;i<eLinks.size();i++) {
Element eLink = (Element) eLinks.get(i);
Link link = parseLink(feed, entry, baseURI, eLink);
if (link.getRel() == null
|| "".equals(link.getRel().trim())
|| "alternate".equals(link.getRel())) {
links.add(link);
}
}
return (links.size()>0) ? links : null;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:Atom10Parser.java
示例10: parseOtherLinks
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private List parseOtherLinks(Feed feed, Entry entry, URL baseURI, List eLinks) {
List links = new ArrayList();
for (int i=0;i<eLinks.size();i++) {
Element eLink = (Element) eLinks.get(i);
Link link = parseLink(feed, entry, baseURI, eLink);
if (!"alternate".equals(link.getRel())) {
links.add(link);
}
}
return (links.size()>0) ? links : null;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:Atom10Parser.java
示例11: parseEntry
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private Entry parseEntry(Feed feed, Element eEntry, URL baseURI) {
Entry entry = new Entry();
String xmlBase = eEntry.getAttributeValue("base", Namespace.XML_NAMESPACE);
if (xmlBase != null) {
entry.setXmlBase(xmlBase);
}
Element e = eEntry.getChild("title",getAtomNamespace());
if (e!=null) {
entry.setTitle(e.getText());
}
List eList = eEntry.getChildren("link",getAtomNamespace());
entry.setAlternateLinks(parseAlternateLinks(feed, entry, baseURI, eList));
entry.setOtherLinks(parseOtherLinks(feed, entry, baseURI, eList));
eList = eEntry.getChildren("author", getAtomNamespace());
if (eList.size()>0) {
entry.setAuthors(parsePersons(baseURI, eList));
}
eList = eEntry.getChildren("contributor",getAtomNamespace());
if (eList.size()>0) {
entry.setContributors(parsePersons(baseURI, eList));
}
e = eEntry.getChild("id",getAtomNamespace());
if (e!=null) {
entry.setId(e.getText());
}
e = eEntry.getChild("updated",getAtomNamespace());
if (e!=null) {
entry.setUpdated(DateParser.parseDate(e.getText()));
}
e = eEntry.getChild("published",getAtomNamespace());
if (e!=null) {
entry.setPublished(DateParser.parseDate(e.getText()));
}
e = eEntry.getChild("summary",getAtomNamespace());
if (e!=null) {
entry.setSummary(parseContent(e));
}
e = eEntry.getChild("content",getAtomNamespace());
if (e!=null) {
List contents = new ArrayList();
contents.add(parseContent(e));
entry.setContents(contents);
}
e = eEntry.getChild("rights",getAtomNamespace());
if (e!=null) {
entry.setRights(e.getText());
}
List cList = eEntry.getChildren("category",getAtomNamespace());
entry.setCategories(parseCategories(baseURI, cList));
// TODO: SHOULD handle Atom entry source element
entry.setModules(parseItemModules(eEntry));
return entry;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:69,代码来源:Atom10Parser.java
示例12: addEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected void addEntries(Feed feed,Element parent) throws FeedException {
List items = feed.getEntries();
for (int i=0;i<items.size();i++) {
addEntry((Entry)items.get(i),parent);
}
checkEntriesConstraints(parent);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:Atom10Generator.java
示例13: addEntry
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected void addEntry(Entry entry,Element parent) throws FeedException {
Element eEntry = new Element("entry", getFeedNamespace());
if (entry.getXmlBase() != null) {
eEntry.setAttribute("base", entry.getXmlBase(), Namespace.XML_NAMESPACE);
}
populateEntry(entry,eEntry);
checkEntryConstraints(eEntry);
generateItemModules(entry.getModules(),eEntry);
parent.addContent(eEntry);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:Atom10Generator.java
示例14: populateEntry
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected void populateEntry(Entry entry, Element eEntry) throws FeedException {
if (entry.getTitle() != null) {
eEntry.addContent(generateSimpleElement("title", entry.getTitle()));
}
List links = entry.getAlternateLinks();
if (links != null) {
for (int i = 0; i < links.size(); i++) {
eEntry.addContent(generateLinkElement((Link)links.get(i)));
}
}
links = entry.getOtherLinks();
if (links != null) {
for (int i = 0; i < links.size(); i++) {
eEntry.addContent(generateLinkElement((Link)links.get(i)));
}
}
List cats = entry.getCategories();
if (cats != null) {
for (int i = 0; i < cats.size(); i++) {
eEntry.addContent(generateCategoryElement((Category)cats.get(i)));
}
}
List authors = entry.getAuthors();
if (authors != null && authors.size() > 0) {
for (int i = 0; i < authors.size(); i++) {
Element authorElement = new Element("author", getFeedNamespace());
fillPersonElement(authorElement, (Person)entry.getAuthors().get(i));
eEntry.addContent(authorElement);
}
}
List contributors = entry.getContributors();
if (contributors != null && contributors.size() > 0) {
for (int i = 0; i < contributors.size(); i++) {
Element contributorElement = new Element("contributor", getFeedNamespace());
fillPersonElement(contributorElement, (Person)contributors.get(i));
eEntry.addContent(contributorElement);
}
}
if (entry.getId() != null) {
eEntry.addContent(generateSimpleElement("id", entry.getId()));
}
if (entry.getUpdated() != null) {
Element updatedElement = new Element("updated", getFeedNamespace());
updatedElement.addContent(DateParser.formatW3CDateTime(entry.getUpdated()));
eEntry.addContent(updatedElement);
}
if (entry.getPublished() != null) {
Element publishedElement = new Element("published", getFeedNamespace());
publishedElement.addContent(DateParser.formatW3CDateTime(entry.getPublished()));
eEntry.addContent(publishedElement);
}
if (entry.getContents() != null && entry.getContents().size() > 0) {
Element contentElement = new Element("content", getFeedNamespace());
Content content = (Content)entry.getContents().get(0);
fillContentElement(contentElement, content);
eEntry.addContent(contentElement);
}
if (entry.getSummary() != null) {
Element summaryElement = new Element("summary", getFeedNamespace());
fillContentElement(summaryElement, entry.getSummary());
eEntry.addContent(summaryElement);
}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:71,代码来源:Atom10Generator.java
示例15: createSyndEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected List createSyndEntries(Feed feed, List atomEntries, boolean preserveWireItems) {
List syndEntries = new ArrayList();
for (int i=0;i<atomEntries.size();i++) {
syndEntries.add(createSyndEntry(feed, (Entry) atomEntries.get(i), preserveWireItems));
}
return syndEntries;
}
开发者ID:4thline,项目名称:feeds,代码行数:8,代码来源:ConverterForAtom10.java
示例16: createSyndEnclosure
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
public SyndEnclosure createSyndEnclosure(Feed feed, Entry entry,
Link link) {
SyndEnclosure syndEncl = new SyndEnclosureImpl();
syndEncl.setUrl(link.getHrefResolved());
syndEncl.setType(link.getType());
syndEncl.setLength(link.getLength());
return syndEncl;
}
开发者ID:4thline,项目名称:feeds,代码行数:9,代码来源:ConverterForAtom10.java
示例17: createSyndEntries
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
protected List createSyndEntries(List atomEntries, boolean preserveWireItems) {
List syndEntries = new ArrayList();
for (int i=0;i<atomEntries.size();i++) {
syndEntries.add(createSyndEntry((Entry) atomEntries.get(i), preserveWireItems));
}
return syndEntries;
}
开发者ID:4thline,项目名称:feeds,代码行数:8,代码来源:ConverterForAtom03.java
示例18: createSyndEnclosure
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
public SyndEnclosure createSyndEnclosure(Entry entry, Link link) {
SyndEnclosure syndEncl = new SyndEnclosureImpl();
syndEncl.setUrl(link.getHrefResolved());
syndEncl.setType(link.getType());
syndEncl.setLength(link.getLength());
return syndEncl;
}
开发者ID:4thline,项目名称:feeds,代码行数:8,代码来源:ConverterForAtom03.java
示例19: parseLink
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private Link parseLink(Feed feed , Entry entry, String baseURI, Element eLink) {
Link link = new Link();
String att = getAttributeValue(eLink, "rel");
if (att!=null) {
link.setRel(att);
}
att = getAttributeValue(eLink, "type");
if (att!=null) {
link.setType(att);
}
att = getAttributeValue(eLink, "href");
if (att!=null) {
link.setHref(att);
if (isRelativeURI(att)) {
link.setHrefResolved(resolveURI(baseURI, eLink, att));
}
}
att = getAttributeValue(eLink, "title");
if (att!=null) {
link.setTitle(att);
}
att = getAttributeValue(eLink, "hreflang");
if (att!=null) {
link.setHreflang(att);
}
att = getAttributeValue(eLink, "length");
if (att!=null) {
Long val = NumberParser.parseLong(att);
if (val != null) {
link.setLength(val.longValue());
}
}
return link;
}
开发者ID:4thline,项目名称:feeds,代码行数:35,代码来源:Atom10Parser.java
示例20: parseAlternateLinks
import com.sun.syndication.feed.atom.Entry; //导入依赖的package包/类
private List parseAlternateLinks(Feed feed, Entry entry, String baseURI, List eLinks) {
List links = new ArrayList();
for (int i=0;i<eLinks.size();i++) {
Element eLink = (Element) eLinks.get(i);
Link link = parseLink(feed, entry, baseURI, eLink);
if (link.getRel() == null
|| "".equals(link.getRel().trim())
|| "alternate".equals(link.getRel())) {
links.add(link);
}
}
return (links.size()>0) ? links : null;
}
开发者ID:4thline,项目名称:feeds,代码行数:14,代码来源:Atom10Parser.java
注:本文中的com.sun.syndication.feed.atom.Entry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论