aspose file tools*
The moose likes Beginning Java and the fly likes XML vs Properties File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "XML vs Properties File" Watch "XML vs Properties File" New topic
Author

XML vs Properties File

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15292
    
    6

Which do you use for storing user settings, global settings, values, etc and why one over the other?


GenRocket - Experts at Building Test Data
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
A properties file is much easier to use when you have a small, fixed set of settings with a plain structure.
An XML file implies more work, but is more appropriate to handle complex hierarchical settings.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If you are comfortable with going for a simple solution first, and only adding extra complexity later if you really need it, then start with a Properties file (or, even bettter, a hard-coded Map).
As long as you have some sort of "facade" through which you access these settings, then it shouldn't matter to the calling code which one you use. Then you are free to use hard-coded default values, load from a properties file, read some XML, run a database query, look them up in a JNDI repository, access a web service etc. etc.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML vs Properties File
 
Similar Threads
Where is the Plugin Console?
A good, simple tutorial for making sockets work over the Internet.
Not to execute console based jdbc application
Error while invoking SAPI with Java Script
how to open .xls file in new window