- 浏览: 424859 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (184)
- IDE (4)
- dotCMS (3)
- Liferay Portal (1)
- J2EE (7)
- My SQL (16)
- IBM DB2 (3)
- Oracle (2)
- JDBC (4)
- Hibernate (3)
- JSP (0)
- Framework (4)
- Java编程 (30)
- C++编程 (0)
- Struts 1.X (2)
- Struts 2.X (6)
- Linux (11)
- Spring (7)
- JavaScript (6)
- Ajax (2)
- XML (3)
- IBM Websphere Portal (1)
- IBM Lotus Quickr (1)
- CMS (2)
- ERP (0)
- CRM (0)
- 大型网站架构开发 (1)
- 面试武器 (2)
- HTML 5 (2)
- dTree && webFxloadTree (2)
- JVM (7)
- SQL Server (3)
- Tomcat && Apache && Jboss && Weblogic-中间件 (4)
- FreeMarker (2)
- MongoDB (7)
- OpenSource开源 (24)
- Cloud (0)
- FFmpeg (3)
- Thrift (1)
- SpringSide (1)
- Design Pattern (1)
- solr&&ES (2)
- git&svn (1)
- 大数据 (8)
- 人工智能 (0)
- Hadoop (3)
- Spark (0)
- Sqoop (1)
- Flume (1)
- Hive (3)
- HDFS (4)
- ES (0)
- Redis (1)
- Kafka (3)
- MR (0)
- 机器学习 (0)
- 深度学习 (0)
- Impala (2)
- HBase (2)
- Spring Boot (1)
- Spring Cloud (0)
- 大数据架构 (6)
- 架构思想理论 (6)
- 技术管理 (4)
- 数据结构与算法 (4)
最新评论
-
huijz:
...
Spring Data JPA研究-使用Spring Data JPA 简化JPA 开发(ZZ) -
用户名不存在:
[img][/img][*]引用[u][/u][i][/i][ ...
MongoDB 模糊查询的三种实现方式-morphia实现 -
junsheng100:
请给个完整的例子吧!包括jar文件等
java调用ffmpeg获取视频文件信息参数代码 -
mj:
谢谢!!
SQL Server里面如何导出包含(insert into)数据的SQL脚本 (转载ZZ)
1.通过Rome插件可以简化对这两种规范文件的解析难度!Rss,Atom一般用在网站订阅功能,可以实现网络资源共享,用户可以通过客户端软件直接浏览各大网站已订阅的文章。简单的来说,电子订阅的特点就是,可以将多个网站上频繁更新的内容如:博客,新闻,聚合到一个网页列表上。ff可以下载sage插件解析,IE7可以直接解析。以下是读写操作的代码示例:
Java代码
1.package rss;
2.
3.import java.io.FileWriter;
4.import java.io.Writer;
5.import java.text.DateFormat;
6.import java.text.SimpleDateFormat;
7.import java.util.ArrayList;
8.import java.util.Date;
9.import java.util.List;
10.
11.import com.sun.syndication.feed.synd.SyndContent;
12.import com.sun.syndication.feed.synd.SyndContentImpl;
13.import com.sun.syndication.feed.synd.SyndEntry;
14.import com.sun.syndication.feed.synd.SyndEntryImpl;
15.import com.sun.syndication.feed.synd.SyndFeed;
16.import com.sun.syndication.feed.synd.SyndFeedImpl;
17.import com.sun.syndication.io.SyndFeedOutput;
18.
19.public class RssWrite {
20.
21. public static void main(String[] args) throws Exception {
22. DateFormat dateParser = new SimpleDateFormat("yyyyMMddhhmmss");
23.
24. SyndFeed feed = new SyndFeedImpl();
25. feed.setFeedType("atom_1.0");
26. feed.setTitle("Sample Feed (created with Rome)");
27. feed.setLink("http://rome.dev.java.net");
28. feed.setDescription("This feed has been created using Rome (Java syndication utilities");
29. feed.setEncoding("utf-8");//默认是utf-8
30.
31. List entries = new ArrayList();
32. SyndEntry entry;
33. SyndContent description;
34.
35. entry = new SyndEntryImpl(); // feed其中的一个 entry, 即其中一篇文章
36.
37. entry.setTitle("Rome v1.0"); // 设置文章标题
38. entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
39. entry.setPublishedDate(new Date());
40. description = new SyndContentImpl(); // 文章的描述
41. description.setType("text/plain");
42. description.setValue("hello caohaigang");
43. entry.setDescription(description);
44. entries.add(entry);
45.
46. entry = new SyndEntryImpl();
47. entry.setTitle("Rome v1.0");
48. entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
49. entry.setPublishedDate(new Date());
50. description = new SyndContentImpl();
51. description.setType("text/plain");
52. description.setValue("<img src=\"http://farm4.static.flickr.com/3026/2645744338_bf6a7e9c57_m.jpg\" />");
53. entry.setDescription(description);
54. entries.add(entry);
55.
56. feed.setEntries(entries); // 设置feed的文章列表
57. String path = "c:/xml";
58. File f = new File(path);
59. if(!f.exists()){
60. f.mkdirs();
61. }
62. String fileName = dateParser.format(new Date())+".xml";
63. //FileWriter输出的XML文件为gb2312编码,这在linux下无法使用
64. //Writer writer = new FileWriter(path + "/" + fileName);
65. //要和正文编码设置一致
66. Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
67. SyndFeedOutput output = new SyndFeedOutput();
68. output.output(feed,writer); // 向客户端输出xml
69. writer.close();
70.
71. System.out.println("The feed has been written to the file ["+fileName+"]");
72. }
73.}
package rss;
import java.io.FileWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.io.SyndFeedOutput;
public class RssWrite {
public static void main(String[] args) throws Exception {
DateFormat dateParser = new SimpleDateFormat("yyyyMMddhhmmss");
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("atom_1.0");
feed.setTitle("Sample Feed (created with Rome)");
feed.setLink("http://rome.dev.java.net");
feed.setDescription("This feed has been created using Rome (Java syndication utilities");
feed.setEncoding("utf-8");//默认是utf-8
List entries = new ArrayList();
SyndEntry entry;
SyndContent description;
entry = new SyndEntryImpl(); // feed其中的一个 entry, 即其中一篇文章
entry.setTitle("Rome v1.0"); // 设置文章标题
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(new Date());
description = new SyndContentImpl(); // 文章的描述
description.setType("text/plain");
description.setValue("hello caohaigang");
entry.setDescription(description);
entries.add(entry);
entry = new SyndEntryImpl();
entry.setTitle("Rome v1.0");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(new Date());
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("<img src=\"http://farm4.static.flickr.com/3026/2645744338_bf6a7e9c57_m.jpg\" />");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries); // 设置feed的文章列表
String path = "c:/xml";
File f = new File(path);
if(!f.exists()){
f.mkdirs();
}
String fileName = dateParser.format(new Date())+".xml";
//FileWriter输出的XML文件为gb2312编码,这在linux下无法使用
//Writer writer = new FileWriter(path + "/" + fileName);
//要和正文编码设置一致
Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed,writer); // 向客户端输出xml
writer.close();
System.out.println("The feed has been written to the file ["+fileName+"]");
}
}
Java代码
1.import com.sun.syndication.feed.synd.SyndEntry;
2.import com.sun.syndication.feed.synd.SyndFeed;
3.import com.sun.syndication.fetcher.FeedFetcher;
4.import com.sun.syndication.fetcher.impl.FeedFetcherCache;
5.import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
6.import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
7.
8.public class RssReader {
9.
10. public static void main(String[] args) throws Exception {
11. FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
12. FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
13.
14. URL url = new URL("http://www.china-pub.com/rss/FeedPub.asp?id=3");
15. //url是XML文件, 如http://feed.feedsky.com/xxx.xml
16. SyndFeed feed = feedFetcher.retrieveFeed(url);
17. List entryList = feed.getEntries();
18. for (int i = 0; i < entryList.size(); i++) {
19. SyndEntry entry = (SyndEntry) entryList.get(i);
20. System.out.println("Published Date: " + entry.getPublishedDate());
21. System.out.println("Title: " + entry.getTitle());
22. System.out.println("Link: " + entry.getLink());
23. SyndContent sc = entry.getDescription();
24. if(sc!=null){
25. System.out.println("Description: " + sc.getValue());
26. }
27. System.out.println("------------------------------");
28. }
29. }
30.}
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
public class RssReader {
public static void main(String[] args) throws Exception {
FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
URL url = new URL("http://www.china-pub.com/rss/FeedPub.asp?id=3");
//url是XML文件, 如http://feed.feedsky.com/xxx.xml
SyndFeed feed = feedFetcher.retrieveFeed(url);
List entryList = feed.getEntries();
for (int i = 0; i < entryList.size(); i++) {
SyndEntry entry = (SyndEntry) entryList.get(i);
System.out.println("Published Date: " + entry.getPublishedDate());
System.out.println("Title: " + entry.getTitle());
System.out.println("Link: " + entry.getLink());
SyndContent sc = entry.getDescription();
if(sc!=null){
System.out.println("Description: " + sc.getValue());
}
System.out.println("------------------------------");
}
}
}
其中FeedType为以下同种中的一种
Java代码
1.public static final String RSS_090 = "rss_0.9";
2.public static final String RSS_092 = "rss_0.92";
3.public static final String RSS_093 = "rss_0.93";
4.public static final String RSS_094 = "rss_0.94";
5.public static final String RSS_091_Netscape = "rss_0.91";
6.public static final String RSS_091_Userland = "rss_0.91";
7.public static final String RSS_100 = "rss_1.0";
8.public static final String RSS_200 = "rss_2.0";
9.public static final String ATOM_030 = "atom_0.3";
10.public static final String ATOM_100 = "atom_1.0";
public static final String RSS_090 = "rss_0.9";
public static final String RSS_092 = "rss_0.92";
public static final String RSS_093 = "rss_0.93";
public static final String RSS_094 = "rss_0.94";
public static final String RSS_091_Netscape = "rss_0.91";
public static final String RSS_091_Userland = "rss_0.91";
public static final String RSS_100 = "rss_1.0";
public static final String RSS_200 = "rss_2.0";
public static final String ATOM_030 = "atom_0.3";
public static final String ATOM_100 = "atom_1.0";
用ROME ,就可以很简单的生成rss, atom或者将rss转化成atom, 等操作..
这个插件需要3个jar包 jdom.jar rome-0.9.jar rome-fetcher-0.9.jar
2.通过rssutils插件可以对RssXml进行读操作,引入jar包之后直接可以通过在jsp页写标签进行输出,优点:使用简单。缺点:仅仅只能对RssXml文件进行读取操作。
Xml代码
1.<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
2.<%@ taglib uri="/WEB-INF/rssutils.tld" prefix="rss" %>
3.
4.<rss:feed
5.url="http://dev.csdn.net/rss/2.xml"
6.feedId="example1"/>
7.<b>Image: </b><rss:channelImage feedId="example1" asLink="true"/><br>
8.<b>Title: </b><rss:channelTitle feedId="example1"/><br>
9.<b>Link: </b><rss:channelLink feedId="example1" asLink="true"/><br>
10.<b>Description: </b><rss:channelDescription feedId="example1"/><br>
11.<ul>
12. <rss:forEachItem feedId="example1">
13. <li><rss:itemTitle feedId="example1"/><br>
14. <rss:itemLink feedId="example1"/><br>
15. <rss:itemDescription feedId="example1"/><br>
16. </rss:forEachItem>
17.</ul>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/rssutils.tld" prefix="rss" %>
<rss:feed
url="http://dev.csdn.net/rss/2.xml"
feedId="example1"/>
<b>Image: </b><rss:channelImage feedId="example1" asLink="true"/><br>
<b>Title: </b><rss:channelTitle feedId="example1"/><br>
<b>Link: </b><rss:channelLink feedId="example1" asLink="true"/><br>
<b>Description: </b><rss:channelDescription feedId="example1"/><br>
<ul>
<rss:forEachItem feedId="example1">
<li><rss:itemTitle feedId="example1"/><br>
<rss:itemLink feedId="example1"/><br>
<rss:itemDescription feedId="example1"/><br>
</rss:forEachItem>
</ul>
需要rssutils.jar
Java代码
1.package rss;
2.
3.import java.io.FileWriter;
4.import java.io.Writer;
5.import java.text.DateFormat;
6.import java.text.SimpleDateFormat;
7.import java.util.ArrayList;
8.import java.util.Date;
9.import java.util.List;
10.
11.import com.sun.syndication.feed.synd.SyndContent;
12.import com.sun.syndication.feed.synd.SyndContentImpl;
13.import com.sun.syndication.feed.synd.SyndEntry;
14.import com.sun.syndication.feed.synd.SyndEntryImpl;
15.import com.sun.syndication.feed.synd.SyndFeed;
16.import com.sun.syndication.feed.synd.SyndFeedImpl;
17.import com.sun.syndication.io.SyndFeedOutput;
18.
19.public class RssWrite {
20.
21. public static void main(String[] args) throws Exception {
22. DateFormat dateParser = new SimpleDateFormat("yyyyMMddhhmmss");
23.
24. SyndFeed feed = new SyndFeedImpl();
25. feed.setFeedType("atom_1.0");
26. feed.setTitle("Sample Feed (created with Rome)");
27. feed.setLink("http://rome.dev.java.net");
28. feed.setDescription("This feed has been created using Rome (Java syndication utilities");
29. feed.setEncoding("utf-8");//默认是utf-8
30.
31. List entries = new ArrayList();
32. SyndEntry entry;
33. SyndContent description;
34.
35. entry = new SyndEntryImpl(); // feed其中的一个 entry, 即其中一篇文章
36.
37. entry.setTitle("Rome v1.0"); // 设置文章标题
38. entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
39. entry.setPublishedDate(new Date());
40. description = new SyndContentImpl(); // 文章的描述
41. description.setType("text/plain");
42. description.setValue("hello caohaigang");
43. entry.setDescription(description);
44. entries.add(entry);
45.
46. entry = new SyndEntryImpl();
47. entry.setTitle("Rome v1.0");
48. entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
49. entry.setPublishedDate(new Date());
50. description = new SyndContentImpl();
51. description.setType("text/plain");
52. description.setValue("<img src=\"http://farm4.static.flickr.com/3026/2645744338_bf6a7e9c57_m.jpg\" />");
53. entry.setDescription(description);
54. entries.add(entry);
55.
56. feed.setEntries(entries); // 设置feed的文章列表
57. String path = "c:/xml";
58. File f = new File(path);
59. if(!f.exists()){
60. f.mkdirs();
61. }
62. String fileName = dateParser.format(new Date())+".xml";
63. //FileWriter输出的XML文件为gb2312编码,这在linux下无法使用
64. //Writer writer = new FileWriter(path + "/" + fileName);
65. //要和正文编码设置一致
66. Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
67. SyndFeedOutput output = new SyndFeedOutput();
68. output.output(feed,writer); // 向客户端输出xml
69. writer.close();
70.
71. System.out.println("The feed has been written to the file ["+fileName+"]");
72. }
73.}
package rss;
import java.io.FileWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.io.SyndFeedOutput;
public class RssWrite {
public static void main(String[] args) throws Exception {
DateFormat dateParser = new SimpleDateFormat("yyyyMMddhhmmss");
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("atom_1.0");
feed.setTitle("Sample Feed (created with Rome)");
feed.setLink("http://rome.dev.java.net");
feed.setDescription("This feed has been created using Rome (Java syndication utilities");
feed.setEncoding("utf-8");//默认是utf-8
List entries = new ArrayList();
SyndEntry entry;
SyndContent description;
entry = new SyndEntryImpl(); // feed其中的一个 entry, 即其中一篇文章
entry.setTitle("Rome v1.0"); // 设置文章标题
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(new Date());
description = new SyndContentImpl(); // 文章的描述
description.setType("text/plain");
description.setValue("hello caohaigang");
entry.setDescription(description);
entries.add(entry);
entry = new SyndEntryImpl();
entry.setTitle("Rome v1.0");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(new Date());
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("<img src=\"http://farm4.static.flickr.com/3026/2645744338_bf6a7e9c57_m.jpg\" />");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries); // 设置feed的文章列表
String path = "c:/xml";
File f = new File(path);
if(!f.exists()){
f.mkdirs();
}
String fileName = dateParser.format(new Date())+".xml";
//FileWriter输出的XML文件为gb2312编码,这在linux下无法使用
//Writer writer = new FileWriter(path + "/" + fileName);
//要和正文编码设置一致
Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed,writer); // 向客户端输出xml
writer.close();
System.out.println("The feed has been written to the file ["+fileName+"]");
}
}
Java代码
1.import com.sun.syndication.feed.synd.SyndEntry;
2.import com.sun.syndication.feed.synd.SyndFeed;
3.import com.sun.syndication.fetcher.FeedFetcher;
4.import com.sun.syndication.fetcher.impl.FeedFetcherCache;
5.import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
6.import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
7.
8.public class RssReader {
9.
10. public static void main(String[] args) throws Exception {
11. FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
12. FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
13.
14. URL url = new URL("http://www.china-pub.com/rss/FeedPub.asp?id=3");
15. //url是XML文件, 如http://feed.feedsky.com/xxx.xml
16. SyndFeed feed = feedFetcher.retrieveFeed(url);
17. List entryList = feed.getEntries();
18. for (int i = 0; i < entryList.size(); i++) {
19. SyndEntry entry = (SyndEntry) entryList.get(i);
20. System.out.println("Published Date: " + entry.getPublishedDate());
21. System.out.println("Title: " + entry.getTitle());
22. System.out.println("Link: " + entry.getLink());
23. SyndContent sc = entry.getDescription();
24. if(sc!=null){
25. System.out.println("Description: " + sc.getValue());
26. }
27. System.out.println("------------------------------");
28. }
29. }
30.}
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
public class RssReader {
public static void main(String[] args) throws Exception {
FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
URL url = new URL("http://www.china-pub.com/rss/FeedPub.asp?id=3");
//url是XML文件, 如http://feed.feedsky.com/xxx.xml
SyndFeed feed = feedFetcher.retrieveFeed(url);
List entryList = feed.getEntries();
for (int i = 0; i < entryList.size(); i++) {
SyndEntry entry = (SyndEntry) entryList.get(i);
System.out.println("Published Date: " + entry.getPublishedDate());
System.out.println("Title: " + entry.getTitle());
System.out.println("Link: " + entry.getLink());
SyndContent sc = entry.getDescription();
if(sc!=null){
System.out.println("Description: " + sc.getValue());
}
System.out.println("------------------------------");
}
}
}
其中FeedType为以下同种中的一种
Java代码
1.public static final String RSS_090 = "rss_0.9";
2.public static final String RSS_092 = "rss_0.92";
3.public static final String RSS_093 = "rss_0.93";
4.public static final String RSS_094 = "rss_0.94";
5.public static final String RSS_091_Netscape = "rss_0.91";
6.public static final String RSS_091_Userland = "rss_0.91";
7.public static final String RSS_100 = "rss_1.0";
8.public static final String RSS_200 = "rss_2.0";
9.public static final String ATOM_030 = "atom_0.3";
10.public static final String ATOM_100 = "atom_1.0";
public static final String RSS_090 = "rss_0.9";
public static final String RSS_092 = "rss_0.92";
public static final String RSS_093 = "rss_0.93";
public static final String RSS_094 = "rss_0.94";
public static final String RSS_091_Netscape = "rss_0.91";
public static final String RSS_091_Userland = "rss_0.91";
public static final String RSS_100 = "rss_1.0";
public static final String RSS_200 = "rss_2.0";
public static final String ATOM_030 = "atom_0.3";
public static final String ATOM_100 = "atom_1.0";
用ROME ,就可以很简单的生成rss, atom或者将rss转化成atom, 等操作..
这个插件需要3个jar包 jdom.jar rome-0.9.jar rome-fetcher-0.9.jar
2.通过rssutils插件可以对RssXml进行读操作,引入jar包之后直接可以通过在jsp页写标签进行输出,优点:使用简单。缺点:仅仅只能对RssXml文件进行读取操作。
Xml代码
1.<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
2.<%@ taglib uri="/WEB-INF/rssutils.tld" prefix="rss" %>
3.
4.<rss:feed
5.url="http://dev.csdn.net/rss/2.xml"
6.feedId="example1"/>
7.<b>Image: </b><rss:channelImage feedId="example1" asLink="true"/><br>
8.<b>Title: </b><rss:channelTitle feedId="example1"/><br>
9.<b>Link: </b><rss:channelLink feedId="example1" asLink="true"/><br>
10.<b>Description: </b><rss:channelDescription feedId="example1"/><br>
11.<ul>
12. <rss:forEachItem feedId="example1">
13. <li><rss:itemTitle feedId="example1"/><br>
14. <rss:itemLink feedId="example1"/><br>
15. <rss:itemDescription feedId="example1"/><br>
16. </rss:forEachItem>
17.</ul>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/rssutils.tld" prefix="rss" %>
<rss:feed
url="http://dev.csdn.net/rss/2.xml"
feedId="example1"/>
<b>Image: </b><rss:channelImage feedId="example1" asLink="true"/><br>
<b>Title: </b><rss:channelTitle feedId="example1"/><br>
<b>Link: </b><rss:channelLink feedId="example1" asLink="true"/><br>
<b>Description: </b><rss:channelDescription feedId="example1"/><br>
<ul>
<rss:forEachItem feedId="example1">
<li><rss:itemTitle feedId="example1"/><br>
<rss:itemLink feedId="example1"/><br>
<rss:itemDescription feedId="example1"/><br>
</rss:forEachItem>
</ul>
需要rssutils.jar
相关推荐
1. **RSS和Atom Feed解析**:Rome库提供了`RSSModule`和`AtomModule`类,它们实现了JSR 172(JavaTM API for XML Processing, JAXP)的`Unmarshaller`接口,能够将XML数据转换为Java对象。通过这些模块,开发者可以...
这个库包括了RSS和Atom规范的模型类,以及解析和生成XML文档的工具。要使用Rome,你需要将其添加到你的项目依赖中。如果你使用的是Maven,可以在pom.xml文件中添加以下依赖: ```xml <groupId>...
在使用Rome时,应注意正确处理异常,避免内存泄漏,并遵循RSS和Atom的规范,以确保兼容性和用户体验。 总的来说,Rome是一个强大的工具,简化了Java开发者处理RSS和Atom提要的工作,无论是创建新的提要,还是解析...
它包含了RSS和Atom feed的解析、生成以及模型化等功能,使得开发者能够方便地与这些格式进行交互。 其次,JDOM是Java文档对象模型,它是处理XML文档的一种高效、灵活的API。JDOM提供了对XML文档结构的直接映射,...
5. **验证和测试**:编写完成后,可以使用RSS验证工具检查XML文件是否符合RSS规范,确保其可被RSS阅读器正确解析。 这个压缩包中的“RSS”可能是包含上述步骤实现的源代码文件或者已经生成的RSS XML文件。对于初学...
通过使用ROME,开发者可以轻松地解析、创建和更新RSS和Atom feeds,从而快速构建RSS相关的应用程序。 1. **API接口**:ROME1.0提供了一套清晰、易于使用的API,允许开发者创建和操作RSS和Atom feeds。例如,你可以...
通过JDOM,开发者可以高效地操作XML数据,而通过ROME,他们可以轻松地解析、生成和管理RSS和Atom feeds。对于那些需要构建新闻聚合应用或需要从网上获取RSS内容的开发者来说,这个包具有很高的实用价值。
《RSS与Atom在行动》一书深入探讨了RSS(Really Simple Syndication)和Atom两种流行的网络内容聚合格式,它们是Web 2.0的核心构建块,由Dave Johnson撰写,Manning出版社出版。RSS和Atom是两种用于发布、聚合和订阅...
RSS是一种用于发布和聚合新闻、博客、播客等在线内容的XML格式。它允许用户订阅感兴趣的网站,通过RSS阅读器获取更新,无需频繁访问各个网站。 【描述】中的“rss读写功能”指的是开发应用程序时实现的两个关键操作...
1. **RSS和Atom Feed的解析**:Rome提供了API,能够解析RSS 2.0、RSS 1.0、RSS 0.9x、Atom 0.3和Atom 1.0等各种版本的feed格式,将这些XML数据转化为Java对象,方便进行进一步的操作。 2. **内容生成**:除了解析,...
Java RSS开发是一个重要的领域,主要用于创建、解析和发布RSS(Really Simple Syndication) feeds,这是一种标准格式,用于网站内容的聚合和更新。本压缩包"java_rss.rar"包含了几个关键库,帮助开发者处理RSS相关...
Rome提供了一系列的类和接口,可以方便地创建、解析和操纵RSS和Atom feeds。例如,`RssReader`类用于读取RSS源,` SyndFeed`类代表一个聚合,包含各种频道信息和条目。通过这个库,开发者可以轻松地获取RSS馈送中的...
Rome是一个Java库,专门用于处理RSS和Atom feeds,提供了方便的API来解析、构建和更新这些订阅源。 当处理包含中文字符的RSS源时,问题往往源于字符编码的不一致。在RSS feed中,每个条目的内容都应以某种字符编码...
标题中的"rome0.9"指的是Rome库的一个版本,该版本提供了对RSS 2.0规范的良好支持,同时也可以处理 Atom 1.0 格式,便于开发者创建、编辑和管理RSS和Atom feed。 Rome0.9包含以下主要功能: 1. **RSS和Atom Feed...
《JDOM与ROME:解析与聚合RSS Feed的实用组合》 在Java开发中,处理XML文档是一项常见的任务,而JDOM(Java Document Object Model)和ROME(Really Simple Syndication)库则是为此目的而设计的强大工具。这两个库...
- Rome是一个轻量级的Java库,专注于XML feeds的处理,支持RSS 0.9x, RSS 1.0, RSS 2.0, Atom 0.3 和 Atom 1.0 格式。 - 它提供了丰富的API,用于解析和生成feed,方便开发者进行数据操作和定制化开发。 - Rome的...
"rome-1.0.jar" 和 "rome.jar" 是两个这样的库,它们主要用于处理RSS(Really Simple Syndication)和Atom格式的数据,即新闻聚合和内容发布的标准。这些jar文件包含了处理这些格式的类和方法,使得开发者无需从头...
1. **RSS解析**:Rome0.9包含了一系列的解析器类,如` SyndFeedInput`,可以将XML字符串或文件解析为一个`SyndFeed`对象,该对象包含了RSS源的所有信息,如频道标题、描述、链接以及条目(items)等。 2. **RSS生成...