I am just been introduced with a new application where I see that SQL Queries are stored in XML files rather than being stored as a property in the property file. Is there any benefit from retrieving from XML rather than from Property.
Please let me know other criteria on which property can be compared to XML
XML has capabilities/flexibilities that properties files have not. Whether those make a difference in your case, we can't possibly know. Assuming that those files are read only once at application startup, I can't imagine that using one or the other has a noticeable performance impact.
Yes these files are loaded once into the cache at the time of startup. But as you have said that there is no noticeable performance difference when using XML or property, then what benefit do we get from using XML for storing information when properties are easier to maintain and more intuitive and comprehensive.
And for that matter why not even the server configurations details also not in properties like instead of struts.xml why not struts.properties for same purpose or instead of web.xml we have web.properties and likewise. Eventually both are accessed at runtime.
what benefit do we get from using XML for storing information when properties are easier to maintain and more intuitive and comprehensive.
You would not be wondering if you had tried to work with early servlet containers before web.xml was standardized. There was a profusion of properties files with complicated names and the names of properties used a sort of dot notation to associate values with various parts of the system.
XML rescued us from that mess because it can:
1. represent complex data hierarchies close to the way programmers think about them
2. be modified by adding new elements without screwing up the interpretation of the older ones.
3. be subject to formal proof of correct structure, etc
Joined: Aug 03, 2008
So i get it. Use XML
1. When you want validation of content.
2. And hierarchical representation of our data.
as far as performance access of data is concerned, Not much of a difference.
subject: Better Access performance : XML vs Properties