Java Reference
In-Depth Information
/**
* Load the channle node.
* @param channel A node that contains a channel.
*/
private void loadChannel(Node channel)
{
NodeList nl = channel.getChildNodes();
for (int i = 0; i < nl.getLength(); i++)
{
Node node = nl.item(i);
String nodename = node.getNodeName();
if (nodename.equalsIgnoreCase("item"))
{
loadItem(node);
} else
{
if (node.getNodeType() != Node.TEXT_NODE)
attributes.put(nodename, RSS.getXMLText(node));
}
}
}
/**
* Load all RSS data from the specified URL.
* @param url URL that contains XML data.
* @throws IOException Thrown if an IO error occurs.
* @throws SAXException Thrown if there is an error while
* parsing XML.
* @throws ParserConfigurationException Thrown if there
* is an XML
* parse config error.
*/
public void load(URL url) throws IOException, SAXException,
ParserConfigurationException
{
URLConnection http = url.openConnection();
InputStream is = http.getInputStream();
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
Document d = factory.newDocumentBuilder().parse(is);
Element e = d.getDocumentElement();
NodeList nl = e.getChildNodes();
for (int i = 0; i < nl.getLength(); i++)
{
Search WWH ::




Custom Search