This Java tip illustrates a method of deserialize a bean from XML. For developer information, when a Bean instance is serialized, it is converted into a data stream and written to storage. Any applet, application, or tool that uses that Bean can then "reconstitute" it by deserialization.

 // Deserialize an object
    try {
        XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(
            new FileInputStream("infilename.xml")));
        MyClass obj = (MyClass)decoder.readObject();
        // Use the object
        int property = obj.getProp();     // 1
        int[] properties = obj.getProps(); // [1, 2, 3]
    } catch (FileNotFoundException e) {

Here is the XML data being deserialized:

    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.4.0" class="java.beans.XMLDecoder">
        <object class="MyClass">
            <void property="prop">
            <void property="props">
                <array class="int" length="3">
                    <void index="0">
                    <void index="1">
                    <void index="2">