Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Convert JTree to XML

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 28
Mac MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
IBM DB2 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic