Java tutorial
//package com.java2s; import java.util.ArrayList; import org.w3c.dom.Document; import org.w3c.dom.NodeList; public class Main { public static ArrayList<String> getArrayListTextValuesByDocument(Document document, String tag) { ArrayList<String> result = new ArrayList<String>(); NodeList nodeList = document.getElementsByTagName(tag); int length = nodeList.getLength(); for (int i = 0; i < length; i++) result.add(nodeList.item(i).getTextContent()); return result; } }