本文整理汇总了Java中com.sun.syndication.feed.synd.SyndCategory.getName方法的典型用法代码示例。如果您正苦于以下问题:Java SyndCategory.getName方法的具体用法?Java SyndCategory.getName怎么用?Java SyndCategory.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.syndication.feed.synd.SyndCategory
的用法示例。
在下文中一共展示了SyndCategory.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCategories
import com.sun.syndication.feed.synd.SyndCategory; //导入方法依赖的package包/类
/**
* Returns a list of categories for feed or entry.
*
* @param categories
* @return
*/
private ArrayList<BasicDBObject> getCategories(
ArrayList<SyndCategory> categories) {
ArrayList<BasicDBObject> categoriesDB = new ArrayList<BasicDBObject>();
for (SyndCategory category : categories) {
BasicDBObject categoryDB = new BasicDBObject();
if (category.getName() != null)
categoryDB.append("name", category.getName());
if (category.getTaxonomyUri() != null)
categoryDB.append("taxonomyURI", category.getTaxonomyUri());
if (category.getName() != null || category.getTaxonomyUri() != null)
categoriesDB.add(categoryDB);
}
return categoriesDB;
}
示例2: parse
import com.sun.syndication.feed.synd.SyndCategory; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void parse() throws Exception {
SyndFeedInput input = new SyndFeedInput();
byte b[] = downloadAndSendBinary(url);
if (b != null) {
SyndFeed feed = input.build(new XmlReader(new ByteArrayInputStream(b)));
name = feed.getTitle();
if (feed.getCategories() != null && feed.getCategories().size() > 0) {
SyndCategory category = (SyndCategory) feed.getCategories().get(0);
tempCategory = category.getName();
}
List<SyndEntry> entries = feed.getEntries();
for (SyndEntry entry : entries) {
tempItemTitle = entry.getTitle();
tempItemLink = entry.getLink();
tempFeedLink = entry.getUri();
tempItemThumbURL = null;
ArrayList<Element> elements = (ArrayList<Element>) entry.getForeignMarkup();
for (Element elt : elements) {
if ("group".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())) {
List<Content> subElts = elt.getContent();
for (Content subelt : subElts) {
if (subelt instanceof Element) {
parseElement((Element) subelt, false);
}
}
}
parseElement(elt, true);
}
List<SyndEnclosure> enclosures = entry.getEnclosures();
for (SyndEnclosure enc : enclosures) {
if (StringUtils.isNotBlank(enc.getUrl())) {
tempItemLink = enc.getUrl();
}
}
manageItem();
}
}
setLastModified(System.currentTimeMillis());
}