本文整理汇总了Java中com.sun.syndication.feed.synd.SyndContent.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java SyndContent.getValue方法的具体用法?Java SyndContent.getValue怎么用?Java SyndContent.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.syndication.feed.synd.SyndContent
的用法示例。
在下文中一共展示了SyndContent.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stripTags
import com.sun.syndication.feed.synd.SyndContent; //导入方法依赖的package包/类
private static String stripTags(SyndContent c) {
if (c == null)
return "";
String value = c.getValue();
String[] parts = value.split("<[^>]*>");
StringBuffer buf = new StringBuffer();
for (String part : parts)
buf.append(part);
return buf.toString().trim();
}
示例2: stripTags
import com.sun.syndication.feed.synd.SyndContent; //导入方法依赖的package包/类
private static String stripTags(SyndContent c) {
if (c == null)
return "";
String value = c.getValue();
String[] parts = value.split("<[^>]*>");
StringBuffer buf = new StringBuffer();
for (String part : parts)
buf.append(part);
return buf.toString().trim();
}
示例3: getDescription
import com.sun.syndication.feed.synd.SyndContent; //导入方法依赖的package包/类
@Override
public String getDescription() {
String result = null;
SyndContent syndContent = syndEntry.getDescription();
if (syndContent != null) {
result = syndContent.getValue();
}
return result;
}
示例4: createFeedEntry
import com.sun.syndication.feed.synd.SyndContent; //导入方法依赖的package包/类
protected FeedEntry createFeedEntry(long id, SyndEntry syndEntry, long currentTime) {
String descriptionType = null;
String descriptionValue = null;
if (syndEntry.getDescription() != null) {
if (syndEntry.getDescription().getType() != null) {
descriptionType = syndEntry.getDescription().getType();
}
if (syndEntry.getDescription().getValue() != null) {
descriptionValue = syndEntry.getDescription().getValue();
}
}
// If we don't have description (summary on atom feed entry), use the first content item
if (descriptionValue == null && syndEntry.getContents().size() > 0) {
SyndContent content = syndEntry.getContents().get(0);
descriptionType = content.getType();
descriptionValue = content.getValue();
}
// Fallback to safe values
if (descriptionValue == null || descriptionValue.length() == 0
|| descriptionType == null || descriptionType.length() == 0) {
descriptionValue = FeedEntry.DEFAULT_DESCRIPTION_VALUE;
descriptionType = FeedEntry.DEFAULT_DESCRIPTION_TYPE;
}
// Proper MIME types
if (descriptionType.equals(Content.HTML)) {
descriptionType = "text/html";
} else if (descriptionType.equals(Content.TEXT)) {
descriptionType = "text/plain";
} else if (descriptionType.equals(Content.XHTML)) {
descriptionType = "application/xhtml+xml";
}
return new FeedEntry(
null,
id,
syndEntry.getLink(),
syndEntry.getTitle() != null && syndEntry.getTitle().length() > 0 ? syndEntry.getTitle() : FeedEntry.DEFAULT_TITLE,
syndEntry.getAuthor() != null && syndEntry.getAuthor().length() > 0 ? syndEntry.getAuthor() : FeedEntry.DEFAULT_AUTHOR,
currentTime,
syndEntry.getPublishedDate() != null ? syndEntry.getPublishedDate().getTime() : FeedEntry.DEFAULT_DATE,
syndEntry.getUpdatedDate() != null ? syndEntry.getUpdatedDate().getTime() : FeedEntry.DEFAULT_DATE,
descriptionType,
descriptionValue,
false
);
}