Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best Way to present XML in GUI app?

 
K Riaz
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a <configuration> XML file with interations of <operation>, e.g.

<configuration>
<operation>...</operation>
<operation>...</operation>
...and so on
</configuration>

Each operation can define a number of variable tags which are specific to that operation. All operations have at least a <name> tag.

I want to design a GUI application which will conveniently display the XML to make it easier for a user to view and edit it, without having to open a text editor to browse a large and messy XML file and scrolling down to locate an operation and carefully editing it.

My question is, what would be the best way to design such a GUI application? What components should I use? I thought about having some sort of window with two frames on the left and right. On the left there would be a simple List box with all the operation names (pulled from the XML). When a user selects a particular operation, its associated tags would be displayed on the right with various "label-textfields" for each tag. This would need to be dynamic because the tags within each operation are not fixed, so one operation may need just 4 labels-textfields whilst another may need 10. I have seen some other components such as Trees which could be useful.

Can someone think of anything better/simpler or anticipate any problems? I am thinking about using JDOM as my XML parser for reading and writing the configuration, and either Swing or SWT (still undecided) for the GUI API.

Any ideas very welcome.

Thanks.

[ January 23, 2005: Message edited by: Kashif Riaz ]
[ January 23, 2005: Message edited by: Kashif Riaz ]
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a List like you stated. You could also use a JTree. Along with those you could display the editable info in a simple for or you could use something like a Properties Box. There are really numerous ways to do it. It's hard to suggest just one.

Who are you making this app for? Maybe you could ask a group of end users how they would like to edit the XML file?
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use JDOM to parse the xml file its extremly easy, just learned it in about an hour and implemented it quite nicely.

For my application i displayed the information from the xml file in a JTable, but its porbably nothing liek your doing.
 
Darren Bell
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the Eclipse modeling framework to create a model and a view from the DTD or XSD file. You'd then have a view to use in your app.

That's if you're using SWT/JFACE though.

daz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic