import javax.xml.parsers.*; import org.w3c.dom.*; import java.io.*; public class XMLTester { public static void main(String[] args) throws Exception { //Create a new factory to use to generate a DocumentBuilder DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); //Make the parser aware of the namespaces factory.setNamespaceAware(true); //Create a new DocumentBuilder DocumentBuilder d = factory.newDocumentBuilder(); //Fetch the most recent Coverville feed Document doc = d.parse("http://feeds.feedburner.com/coverville"); //Retrieve all elements with tag title NodeList nl = doc.getElementsByTagName("title"); //for each element with tag title // print its contents for(int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); NodeList children = n.getChildNodes(); for(int j = 0; j < children.getLength(); j++) { System.out.println(children.item(j).getNodeValue()); } System.out.println("*******************\n\n"); } } }