Here you can find the source of getStringOptionsList(final Element configuration, final String optionPrefix, final String option)
public static String[] getStringOptionsList(final Element configuration, final String optionPrefix, final String option)
//package com.java2s; /*//from ww w. j a v a2s .co m * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ import org.w3c.dom.Element; import java.util.Arrays; public class Main { public static String[] getStringOptionsList(final Element configuration, final String optionPrefix, final String option) { String[] optionsList = new String[0]; Element optionsElement = null; try { optionsElement = (Element) configuration.getElementsByTagName(optionPrefix).item(0); } catch (NullPointerException e) { return optionsList; } String[] skiped = null; try { skiped = optionsElement.getAttribute(option).split(";"); } catch (NullPointerException e) { } int badValues = 0; if (skiped != null) { for (int i = 0; i < skiped.length; i++) { if (skiped[i].trim().length() == 0) { skiped[i] = null; badValues++; } } optionsList = new String[skiped.length - badValues]; for (int i = 0, j = 0; i < skiped.length; i++) { if (skiped[i] != null) { optionsList[j++] = skiped[i]; } } } Arrays.sort(optionsList); return optionsList; } }