Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static List<String> getElementTextList(final Element eElement, final String name) { NodeList nodeList = eElement.getElementsByTagName(name); if (nodeList != null && nodeList.getLength() > 0) { int length = nodeList.getLength(); List<String> nodeItems = new ArrayList<String>(); for (int index = 0; index < length; ++index) { nodeItems.add(nodeList.item(index).getTextContent().trim()); } return nodeItems; } return Collections.EMPTY_LIST; } }