You would use an XML parser. Luckily, JDK offers these out-of-the-box in form of JAXP. Now, there are several ways to do it, as there are few major "flavours" of parsing XML. For this task, I believe DOM parser would be easiest to use. You could do it like that:
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document document = builder.parse(new File("name/of/the/file.xml"));
Element root = document.getDocumentElement();
and then use DOM traversal API.
Edit: it was not clear from the original question that the data you want to process is large. In that case, DOM parser is indeed not a good solution, precisely due to memory consumption. For the purpose of parsing large XML documents, SAX and StAX parsers were invented. You might find them a little more cumbersome to use, due to their streaming nature, but that's also the source of their efficiency. Linked Oracle JAXP tutorial has sections on SAX and StAX as well.