本文整理汇总了Java中com.sun.syndication.feed.atom.Feed类的典型用法代码示例。如果您正苦于以下问题:Java Feed类的具体用法?Java Feed怎么用?Java Feed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Feed类属于com.sun.syndication.feed.atom包,在下文中一共展示了Feed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseLink
import com.sun.syndication.feed.atom.Feed; //导入依赖的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: createRootElement
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
protected Element createRootElement(Feed feed) {
Element root = new Element("feed",getFeedNamespace());
root.addNamespaceDeclaration(getFeedNamespace());
//Attribute version = new Attribute("version", getVersion());
//root.setAttribute(version);
if (feed.getXmlBase() != null) {
root.setAttribute("base", feed.getXmlBase(), Namespace.XML_NAMESPACE);
}
generateModuleNamespaceDefs(root);
return root;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:Atom10Generator.java
示例3: parseEntry
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例4: serializeEntry
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例5: createViaStruct
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
public void createViaStruct(cfTag tag, cfStructData cffeeddata ) throws cfmRunTimeException {
String type = cffeeddata.getData("version").getString();
if ( type.equals("rss_2.0") ){
activeRSS = new Channel( type );
}else if ( type.equals("atom_1.0") ){
activeATOM = new Feed( type );
}else{
throw tag.newRunTimeException( "Invalid feed format; only supporting rss_2.0 and atom_1.0" );
}
if ( activeRSS != null ){
renderMetaDataToRss( tag, cffeeddata );
renderEntriesToRss( tag, cffeeddata );
}else if ( activeATOM != null ){
renderMetaDataToAtom( tag, cffeeddata );
renderEntriesToAtom( tag, cffeeddata );
}
}
开发者ID:OpenBD,项目名称:openbd-core,代码行数:20,代码来源:CreateFeed.java
示例6: createViaQuery
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
public void createViaQuery(cfTag tag, cfQueryResultData query, cfStructData properties, cfStructData columnMap ) throws cfmRunTimeException {
String type = properties.getData("version").getString();
if ( type.equals("rss_2.0") ){
activeRSS = new Channel( type );
}else if ( type.equals("atom_1.0") ){
activeATOM = new Feed( type );
}else{
throw tag.newRunTimeException( "Invalid feed format; only supporting rss_2.0 and atom_1.0" );
}
if ( activeRSS != null ){
renderMetaDataToRss( tag, properties );
renderEntriesToRss( tag, convertQueryToStructRss(tag, query, columnMap) );
}else if ( activeATOM != null ){
renderMetaDataToAtom( tag, properties );
renderEntriesToAtom( tag, convertQueryToStructAtom(tag, query, columnMap) );
}
}
开发者ID:OpenBD,项目名称:openbd-core,代码行数:20,代码来源:CreateFeed.java
示例7: read
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例8: createSyndEntries
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例9: createSyndLink
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例10: parseAlternateLinks
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例11: parseOtherLinks
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例12: parseEntries
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
private List parseEntries(Feed feed, URL baseURI, List eEntries) {
List entries = new ArrayList();
for (int i=0;i<eEntries.size();i++) {
entries.add(parseEntry(feed, (Element)eEntries.get(i), baseURI));
}
return (entries.size()>0) ? entries : null;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:Atom10Parser.java
示例13: parseEntry
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例14: addEntries
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例15: createSyndEntries
import com.sun.syndication.feed.atom.Feed; //导入依赖的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.Feed; //导入依赖的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: parseFeed
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
protected WireFeed parseFeed(Element eFeed) throws FeedException {
String baseURI = null;
try {
baseURI = findBaseURI(eFeed);
} catch (Exception e) {
throw new FeedException("ERROR while finding base URI of feed", e);
}
Feed feed = parseFeedMetadata(baseURI, eFeed);
String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE);
if (xmlBase != null) {
feed.setXmlBase(xmlBase);
}
feed.setModules(parseFeedModules(eFeed));
List eList = eFeed.getChildren("entry",getAtomNamespace());
if (eList.size()>0) {
feed.setEntries(parseEntries(feed, baseURI, eList));
}
List foreignMarkup =
extractForeignMarkup(eFeed, feed, getAtomNamespace());
if (foreignMarkup.size() > 0) {
feed.setForeignMarkup(foreignMarkup);
}
return feed;
}
开发者ID:4thline,项目名称:feeds,代码行数:31,代码来源:Atom10Parser.java
示例18: parseLink
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例19: parseAlternateLinks
import com.sun.syndication.feed.atom.Feed; //导入依赖的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
示例20: parseOtherLinks
import com.sun.syndication.feed.atom.Feed; //导入依赖的package包/类
private List parseOtherLinks(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 (!"alternate".equals(link.getRel())) {
links.add(link);
}
}
return (links.size()>0) ? links : null;
}
开发者ID:4thline,项目名称:feeds,代码行数:12,代码来源:Atom10Parser.java
注:本文中的com.sun.syndication.feed.atom.Feed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论