It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes Best Way to present XML in GUI app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Best Way to present XML in GUI app?" Watch "Best Way to present XML in GUI app?" New topic
Author

Best Way to present XML in GUI app?

K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

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?


GenRocket - Experts at Building Test Data
luc comeau
Ranch Hand

Joined: Jan 20, 2005
Posts: 97
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.


National Research Council<br />Internet Logic Department
Darren Bell
Greenhorn

Joined: Aug 01, 2003
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best Way to present XML in GUI app?
 
Similar Threads
pass parameter in url link
Prevent Duplicate Logins
Usings custom tags within your tag handler class
Why no GUI Design Framework?
Need help with XSLT, modifying XML config files.