cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timm, Sean" <ST...@mailgo.com>
Subject RE: XML Resource File?
Date Fri, 04 Feb 2000 20:56:21 GMT
I may just be expounding upon my ignorance by continuing to follow this line
of thought, so please correct my misconceptions.

Basically, we've got several processors that may output particular messages
that need to be customizable by the end user utilizing some sort of tool.
It looks as if the PropertyResourceBundle class works with a text file, so I
suppose that it doesn't necessarily have to be XML.

I'm going to make an assumption about localization and HTTP requests that I
don't necessarily know is true.  I assume that Cocoon can detect the locale
of the requesting browser.

Based on this, I see two ways resource handling could occur within Cocoon:

(1) When a request came into Cocoon for a certain processor or producer,
Cocoon could set the resource information for the specified
producer/processor (this could be specified in the cocoon.properties file)
for the locale of the requesting browser as the working resource
information.  Then you could call to SomeCocoonClass.getResourceString, and
get the appropriate string.

(2) You could define a XSP resource handling taglib and just kick out the
xsp tags wherever you need to load a string from a resource file.

It seems like Cocoon preloads all of the processors available to it (or
something like that...I know I get an error if I don't have the class
installed for a processor mentioned in the cocoon.properties file).  At this
time, Cocoon could load up the appropriate resource file(s) based on the
available locale(s).

Basically, I just like an XML format better than the following:
s1=blah
s2=etc

XML is more flexible and I can do magic transformations with XSLT to spit
out new and interesting data formats.  It's also more extensible for when
you decide that you don't just want to do a simple key/value, you want a
key/value/URL that passes off the value to the URL and does some magic thing
that reinterprets it in Klingonese and passes it back to you.

- Sean T.

-----Original Message-----
From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
Sent: Friday, February 04, 2000 12:44 PM
To: cocoon-dev@xml.apache.org
Subject: Re: XML Resource File?


Timm, Sean wrote:


> Does anyone else see this as useful, or is this ability already there, and
> I'm completely wasting my time? :)
> 
> - Sean T.

java.util.ResourceBundle does this except it doesn't use XML but either
class files or properties files.  The implementation is up to the user if
they choose to implement their own classes but most people would use a Map
or Hashtable.  Anyway, it seems that since there are a lot of other issues
that ResourceBundle's handle transparently like class naming conventions
that allow the correct bundle to accessed based on the locale, reading files
from Properties files if the correct class isn't found, caching of the
object so it's available without having to reload it and other things, it
seems like you're up a against a pretty good existing model.  I'm not sure
what the advantage would be to have the resources stored as XML though?
Isn't it just a key/value pair when it comes down to it?

Mike

Mime
View raw message