Bookmark Topic Watch Topic
  • New Topic

Convert JTree to XML

 
Bob Green
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have an application using JTree and I would like to generate XML file from it. Each node in the JTree is an element in the XML file. What is the best approach to accomplish this task.
I greatly appreciate any ideas anyone can provide me.

Thanks!
 
Eric Snell
Greenhorn
Posts: 28
Java Mac MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Bob Lou:
I have an application using JTree and I would like to generate XML file from it. Each node in the JTree is an element in the XML file. What is the best approach to accomplish this task.
I greatly appreciate any ideas anyone can provide me.

Thanks!


Maybe you can use something like XStream to write out your tree model. You also get the benefit that you can easily read back as a tree model object. You have some control over tags, but others would require much more work to customize.
 
Kranthi Poturaju
Greenhorn
Posts: 4
IBM DB2 Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
...
 
    Bookmark Topic Watch Topic
  • New Topic