Java tutorial
//package com.java2s; //License from project: Apache License import java.beans.XMLDecoder; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<Object> objectXmlDecoder(String source) throws IOException { List<Object> objList = new ArrayList<Object>(); File fin = new File(source); FileInputStream fis = new FileInputStream(fin); XMLDecoder decoder = new XMLDecoder(fis); Object obj = null; try { while ((obj = decoder.readObject()) != null) { objList.add(obj); } } catch (Exception e) { } fis.close(); decoder.close(); return objList; } }