Quantcast
Channel: splitting up of xml file using java - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Andreas Dolk for splitting up of xml file using java

$
0
0

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


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>