NodeList nl; //declare it as an instance variable


new javax.swing.AbstractListModel() {
//    String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
String[] strings = new String[nl.getLength()];
for(int j=0; j<strings.length; j++)strings[j]=nl.item().getNodeValue();

    public int getSize() { return strings.length; }
    public Object getElementAt(int i) { return strings[ i ]; }
}