Integrate data together with RSS. It really provides a lot of convenience.
I don't know if I have no sense, I don't have the source code above the SourceForge, I wrote an RSS reader with DOM, the code is listed below.
Package RssWeb;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c. Dom.CharacterData;
/ ** *
Title: RSS page Display bean p> * *
Description: By calling this bean, implement the RSS in the JSP and display p> *
CopyRight in the page : Copyright (c) 2005 p> * *
Company: UI Studio P> * * @Author uijiang * @version 1.0 * / public class showrs {
// Pretitle Stores the Title name under the RSS Channel project. Public String Pretitle
// iTemList stores the Title name public string under the Item project of RSS [] itemList;
// LinkList stores the LINK name under the Item project of RSS; LinkList;
// Pubdatelist stores the Pubdate name under the Item project of RSS [] PubdateList;
// DESCRIPTIONLIST stores the Description name under the Item project of RSS [] DescriptionList;
// iTemcount records the number of items read from the PUBLIC ITEMCUNT
// Do not use the constructor, not initialize each member, return null public showrs () {}
// Transmit the RSS address in Destination, implement the read operation, and assign values for each member variable. Public Showrss (String Destination) {TRY {
// DOM initialization DocumentBuilderFactory dbFactory = DocumentBuilderFactory newInstance ();. DocumentBuilder documentBuilder = dbFactory.newDocumentBuilder (); Document document = documentBuilder.parse (destination);
// Detecting the number of Item nodelist nodelistcount = document.getElementsBytagname ("item"); itemcount = nodelistcount.getlength ();
// Initialize each member array itemlist = new string [itemcount]; lineList = new string [itemcount]; pubdatelist = new string [itemcount]; DescriptionList = new string [itemcount]; // assignment count int _count = 0;
// Get Title and assign Nodelist nodelisttitle = document.GtelementsBytagname ("Title"); for (int i = 0; i IF (Node.getParentNode (). getnodename (). Trim () == "item") {itemList [_count ] = (characterdata) node.getfirstchild ()). getData ();}} // Assignment count_count = 0; // Get links and assign Nodelist nodelistLink = document.GtelementsBytagname ("link"); for (int i = 0; i // Assignment count_count = 0; // Get pubDataList assignment and NodeList nodelistpubDate = document.getElementsByTagName ( "pubDate") for the member variable; for (int i = 0; i // Get pubDataList assignment and NodeList nodelistDescription = document.getElementsByTagName ( "description") for the member variable; for (int i = 0; i