Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.w3c.dom.Element; public class Main { /** */ public static String[] getTextElements(List<Element> elements) throws Exception { ArrayList<String> list = new ArrayList<String>(); Iterator<Element> iter = elements.iterator(); while (iter.hasNext()) { String s = iter.next().getFirstChild().getTextContent(); list.add(s); } return list.toArray(new String[0]); } }