What's the purpose of Properties.loadFromXML() and Properties.storeToXML() methods?

Eloqbiad

New Member
I am designing a simple library that deals with properties files.I noticed that since JRE 1.5 the class \[code\]Properties\[/code\] defines methods like:\[code\]public synchronized void loadFromXML(InputStream in)public void storeToXML(OutputStream os, String comment)\[/code\]I am questioning the fact that this is a real enhancement in the API of this class. Properties files have been, since JRE 1.5 text based files, and the newly introduced XML format is not adding anything to the functionalities, other than the possibility to use a different forma which is [*]more verbose[*]more complex (to understand, to change, to parse) [*]more inefficient (it uses dom internally to parse into an hastable: it consumes more memory, it requires helper classes in the implementation, and most likely is also slower)[*]more fragile (xml requires escaping of characters <>&"' while properties only need to escape backslashes, since it also supports Java backslash escaping)[*]it breaks backward compatibility of the programs using it, since users running JDK 1.4 won't be able to read xml properties. (ok, who cares...)So I fail to understand the reason behind why engineers in Sun added this feature.The question is: \[quote\] Does anybody finds some advantage of using an XML-based properties files over a traditional text based one?\[/quote\]I need to evaluate this problem, since I don't want to add a useless feature to my simple library that I cited before.\[quote\] Did you ever used an XML-based properties file over a Java Properties file? And why?\[/quote\]Note: same question can be made for Log4J xml file format, but at least Log4J xml format adds nesting ability and some sort of syntax which has some meaning, and I do understand that. But with this xml format for properties, I don't.
 
Back
Top