Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTree to XML

843805Mar 25 2006 — edited Apr 2 2008
Hi everyone,

This might have been asked before but I've scoured the forums and i'm still unsure about how to create an xml representation of a jtree object.
The following code doesn't do the trick:
XMLEncoder xml = null;
JTree loaded = tree1;
try {
	xml = new XMLEncoder( new BufferedOutputStream(
					new FileOutputStream("Test.xml")));
     } 
catch (FileNotFoundException e1) {
	e1.printStackTrace();
}


		xml.writeObject(loaded);
		xml.flush();
		xml.close();
	    }
I assume a jtree cannot be so simply represented in xml but could someone explain how it can be done and what steps I need to take in order to achieve this?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2008
Added on Mar 25 2006
5 comments
864 views