• 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
  • 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

XML vs Properties file

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
which one is good(in performance).for dynamic configuration of application
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming the config information doesn't change during the runtime of the application, performance should not be a major factor in deciding between the two. It's likely that startup and configuration time pale in comparison to the overall execution time of the application.
 
Suresh Sankar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i mean which one is advanced and flexible
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would only go with a properties approach IF:
1. All parameters can be represented as simple name - value pairs
2. There is absolutely no hierarchy or other structure that controls the use of the name - value pairs.

Dynamic configuration (which I take to mean changing the configuration of a running program) can be done with either approach. Just make sure that synchronization is used to prevent access during the changeover, and that changes properly propagate through the system.

I use XML where my applications have to support a fairly deep hierarchy and properties for simple stuff.
Bill
[ July 05, 2005: Message edited by: William Brogden ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well... heirarchy in XML is imposed by the user... this can be done similarly in properties file.
For instance, in XML
<main>
<sub1>
<sub11/>
<sub12/>
</sub1>
</sub2>
</main>

Can be written as
main.sub1.sub11=
main.sub1.sub12=
main.sub2 =

My point is that XML structure/heirarchy can be imposed on properties file.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We used to see a lot of properties files like that in JRun servlet configuration before the servlet API added web.xml
they were a real pain to track, write and edit.
By going to XML you can use the XSLT, Xquery, Xpath, namespaces, entities, DTDs and Schema.
Nothing similar exists for properties.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic