cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neeme Praks" <ne...@one.lv>
Subject RE: ResourceBundles - was [RT] i18n
Date Wed, 21 Jun 2000 18:07:54 GMT

> -----Original Message-----
> From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
> Sent: Wednesday, June 21, 2000 6:54 PM

[snip]

> Cool  - this is much easier to work with.  I was screwing 
> around with your
> previous XML document where everything was an attribute and 
> it was giving me a headache using DOM.

yup, I understand that this approach could come quite complicated ;-)
As I'm referencing this stuff from XML, then I was thinking about
creating a XSLT stylesheet to generate XIncludes from the source and
then let XInclude include all my stuff...
Another way would be to create a XSP taglib and use your XMLResource
approach... have to think about this...

> But, I've been working on this and I have an 
> XMLResourceBundle class that
> takes an XPath as the parameter (if you use a structure similar to the
> above) to it's getString() method and returns the correct 
> value.   So you could say:
> 
> ResourceBundle bundle = ResourceBundle.getBundle("XMLResource", new
> Locale("es", "do"));
>         String word =
> bundle.getString("/resources/forms/contacts-search/input/field
> -to-search/email"));
> // word = e-mail

ok, this is something that I imagined it could be like...

> What I'm not sure how to handle is what if you want to call 
> getObject() or
> geStringArray() instead of getString()?   The 
> handleGetObject() call that I
> override in XMLResourceBundle must return an Object and that 
> is the method
> that is called for getString() and getObject() and 
> getStringArray().  What I
> was thinking of doing is having the getObject() call take an 
> XPath as well
> and then if the XPath points to a node that isn't a 
> Node.TEXT_NODE then
> return an object called something like XMLResourceBundleNode 
> which would in
> turn have it's own getString() method that would do the right thing.
> Anyway, I'm having difficulty wrapping my mind around this.   

Well I think you can provide some basic objects, but for specific
objects people would probably have to extend XMLResource class.
So, for some basic obejcts you could have something like this:
String array:
<email>
	<array>
		<element>neeme@one.lv</element>
		<element>kalamees@one.lv</element>
		.... etc ....
	</array>
</email>

Or date:
<birthday>
	<date>
		<day>25</day>
		<month>05</month>
		<year>1978</year>
	</date>
</birthday>

And then you would have to implement the XML-to-object mapping in this
method... makes sense?

Or then it could be integrated with Castor to do this mapping? Just some
random ideas ;-)

> Sorry I'm posting directly to you but the whole apache.org system
seems 
> to be down today.

it's ok ;-)
Although I seem to be getting some emails from there... and my emails
are getting through also...

Neeme

Mime
View raw message