// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class SaveXMLEnc {
    public static void main(String[] args) {
        try {
            Data o = new Data(123, 123.456, "ABC");
            XMLEncoder xe = new XMLEncoder(new FileOutputStream("C:\\xmlencdec.xml"));
            xe.writeObject(o);
            xe.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
