Outputing DefaultStyledDocument w/ XMLEncoder

Ecks
Ecks used Ask the Experts™
on
Hello all.

I have a class which is storing several Documents that I would like to print out to a file using XMLEncoder.  The goal is to be able to read all aspects of the Document back into the program.  The output is simply a save file.

When I use XMLEncoder on my class I do get a reference to the property storing the Document, but it is obviously not storing the parameters and (indeed) when I load the file back up I do have no Document information.

Here is one of the nodes:

     <void property="dialogDoc">
      <void property="documentProperties">
       <void method="put">
        <object class="java.awt.font.TextAttribute" field="RUN_DIRECTION"/>
        <boolean>false</boolean>
       </void>
      </void>
     </void>

Could someone help me set the proper parameters so the Document to release all of it's secrets to the XML doc?

Many thanks for any help!

Ecks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
can you post your current code ?

Author

Commented:
XMLEncoder out = new XMLEncoder(
  new BufferedOutputStream(
    new FileOutputStream(file)));
out.writeObject(script);
out.close

file is the filename taken from a chooser, and script is the reference to the class.  All of the Document objects are stored in a Vector inside of the 'script'.

Author

Commented:
I've found that a Document is not compatable with XMLEncoder. :(
Points refunded and question closed.

Netminder
EE Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial