Parse the file to create a DOM document. On this DOM select all title
elements and their text contents are the headlines you're looking for.
Quick example with dom4j
:
File xml = new File("input.xml"); // replace with your documentSAXReader reader = new SAXReader();Document doc = reader.read(xml);List titles = doc.selectNode("//item/title"); // a list of all title elementsfor (Object obj:titles) System.out.println(((Element) obj).getText());
Should print all titles to the console