Jason.Herald@gmail.com wrote:
On Jan 12, 5:17 pm, Chris <spam_me_...@goaway.com> wrote:
Does anyone have a nice utility class they use to read/write XML-based
configuration files?
I've gotten away from Properties files because I often need a simple
data structure where 1) the values are hierarchical, 2) there can be
more than one value for a given key, and 3) the order of the values is
preserved.
So I wrote my own little replacement for Properties that has those
features, but I'm not happy with it.
It would better to use something standard and off-the-shelf. Any
suggestions?
The java.util.Properties class will read in properties in xml. I
found this resource which I hope helps:
http://www.ibm.com/developerworks/java/library/j-tiger02254.html
It's positively *amazing* how useful Javadocs can be!
I found this *incredible* reference about Properties and XML at
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html>
!
It goes into a little moredetail at
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#loadFromXML(java.io.InputStream)>
and
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#storeToXML(java.io.OutputStream,%20java.lang.String)>
and
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#storeToXML(java.io.OutputStream,%20java.lang.String,%20java.lang.String)>
It's a wonder how much information one can glean from the documentation!