Java tutorial
import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static void main(String[] args) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuild = dbf.newDocumentBuilder(); Document doc = docBuild.parse(new File("test2.xml")); Element x = doc.getDocumentElement(); NodeList m = x.getChildNodes(); for (int i = 0; i < m.getLength(); i++) { Node it = m.item(i); if (it.getNodeType() == 3) { System.out.println(it.getNodeValue()); } } } }