package com.ttol.spider;import java.io.IOException;
import java.net.URL;
import java.util.List;import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class SipderRss { /**
 * @param args
 */
public static void main(String[] args) {
  String file = "E:/sipxml/sip.xml";
  String url = "http://rss.sina.com.cn/news/china/focus15.xml";
  
SAXBuilder builder = new SAXBuilder();
try {
 Document doc = builder.build(new URL(url));
  Element root=doc.getRootElement();
   Element  el=root.getChild("channel"); //rss2.0
   List listitem=el.getChildren("item");//rss2.0
  System.out.println("共有="+listitem.size());
  for(int i=0;i<listitem.size();i++)
      {
        Element e = (Element)listitem.get(i);       
       System.out.println("title="+e.getChildText("title"));
       System.out.println("link="+e.getChildText("link"));
       System.out.println("category="+e.getChildText("category"));
       System.out.println("description="+e.getChildText("description"));
       System.out.println("time = "+e.getChildText("pubDate"));
       System.out.println();
       System.out.println();
 
 }
}catch (JDOMException e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
} }}上面是我的代码   这个能获取到RSS的资源  比如说标题 发布时间  内容等等   但我想保存的数据库 然后在JSP去从数据库去拿 返回JSON给客户端!