Re: XML properties files - brainstorm

Posted by Adrian Crum on
URL: http://ofbiz.116.s1.nabble.com/XML-properties-files-brainstorm-tp185922p185924.html

I found the answer to the XML file format - java.util.Properties already supports one:

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html


Adrian Crum wrote:

> David Jones has suggested in the past that we start moving away from
> using properties files for UI labels and such, and use XML files
> instead. That subject has come up again in
> https://issues.apache.org/jira/browse/OFBIZ-1425.
>
> I would be interested in helping out with the implementation, but I'd
> like to get input from the developer community first.
>
> -----
>
> Here are some of the suggestions David made:
>
> "If we do something like that, here or anywhere, we should use XML and
> not properties files. XML is about 1E6 times better than properties
> files (name/value pairs) for organizing this sort of information. It is
> hierarchical so much easier to organize and you can use real UTF-8
> characters there instead of having to encode everything and use a
> special tool or a translator to work on the files."
>
> and
>
> "In XML there are standard ways of doing this, namely using the xml:lang
> attribute on an element to specify the language of the content in an
> element."
>
> -----
>
> I have been thinking about this for a while, and I was picturing a
> refactoring of the resource handling code so that it can read xml files
> in addition to *.properties files. The file format would be invisible
> from a programmer's perspective. In other words, the method call
> UtilProperties.getPropertyValue("SomeResource", "SomeProperty") would
> still work even if the "SomeResource" resource was in an XML file.
>
> Or we can just have a utility to retrieve resources from an XML file.
>
> Regardless of how the properties are retrieved, we still need to come up
> with a strategy (or schema) for the xml file format. I'm not an XML
> guru, so this is one area where I could use some help.
>
> Do we continue to keep each language in a separate file or should we
> have all properties for all languages in a single file?
>
> Are there any other issues anyone can think of?
>
> Comments welcome.
>
> -Adrian
>
>
>