Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

how to show a XML tree in GUI?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have questions to consult you! I have a XML file and I want to have it showed in a GUI in a tree structure. The quesions are:

1. what kind of GUI i should use to show the xml tree structure, I think I should use JTree, right?

2. Is there any related code sample? I know there is sample on how to use trees (http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html ), but I don't know how to show xml file in a tree structure .

Thanks for the help!
[ September 12, 2005: Message edited by: marshall ma ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll want to look at a DOM XML API like JDom which reads an XML file into a Tree like structure in memory. Once you have that putting that structure into a JTree is relatively easy.

After a bit of googling (which I hope you are doing) I found the following code on a JDom mailing list. I have not ran or tested this code in any way. So don't complain to me if it doesn't work for whatever reason. At the very least, it should get you going.

 
marshall ma
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gregg Bolinger,

I use different parser from GLUE, still the code is helpful! And definitely your help will get me going. Thanks a lot for your kind help !!

Best Regards,
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic