XMLEncoder a bean : XMLEncoder « XML « Java






XMLEncoder a bean

     

import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;

import javax.swing.JFrame;

public class MainClass {
  public static void main(String args[]) {
    JFrame x = new JFrame("Look at me");
    x.setSize(200, 300);
    x.setVisible(true);
    x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    FileOutputStream f;
    try {
      f = new FileOutputStream("Test.xml");
      XMLEncoder e = new XMLEncoder(new BufferedOutputStream(f));
      e.writeObject(x);
      e.close();
    } catch (Exception e) {
    }
  }
}

   
    
    
    
  








Related examples in the same category

1.Returns true if the argument, a UCS-4 character code, is valid in XML documents.
2.Determining validity of characters outside basic 7-bit range of Unicode, for XML 1.0
3.XML-related tasks and java.io Readers: IETF standard encoding names, automatic detection of most XML encodings
4.Xml Encoding Sniffer
5.Returns true if the character is an XML "letter"
6.XML character properties
7.Encode Xml Attribute
8.Escape / unescape special chars according XML specifications
9.Verify whether the specified character conforms to the XML 1.0 definition of whitespace
10.Returns true if the character is a non-initial character in names according to the XML recommendation
11.Provides HTML and XML entity utilities.