cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject RE: XMLResourceBundle
Date Thu, 22 Jun 2000 02:13:58 GMT

Sorry, I'm reading this a bit out of context (I usually just scan the
Cocoon list looking for stuff that has to do with Xalan).  Is this for
Cocoon2 or Cocoon1?

The Xalan/J 2.0.0 XPath processing will be --much-- more effecient.  I'm
also working with a number of people on an XPath API that will be similar
to TRaX.

So I'm just trying to determine your timeframe and context.

-scott




                                                                                         
                         
                    "Neeme Praks"                                                        
                         
                    <neeme@one.lv        To:     <cocoon-dev@xml.apache.org>    
                                  
                    >                    cc:     (bcc: Scott Boag/CAM/Lotus)          
                            
                                         Subject:     RE: XMLResourceBundle              
                         
                    06/21/2000                                                           
                         
                    05:45 PM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    cocoon-dev                                                           
                         
                                                                                         
                         
                                                                                         
                         




excellent! truly awesome! Thanks Mike! ;-)
Now I need to test it out in action and see how it actually performs.
Anyone with knowledge enough to speed up the XPath processing?

Neeme

> -----Original Message-----
> From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
> Sent: Wednesday, June 21, 2000 11:28 PM
> To: Cocoon Dev
> Subject: XMLResourceBundle
>
>
> I've put together 2 classes that are intended to be a simple
> equivalent to
> the java.util.ResourceBundle's that have become tedious for
> me to use in an
> XML environment.
> I've attached the source for the 2 classes
> XMLResourceBundleFactory and
> XMLResourceBundle.
>
> XMLResourceBundleFactory has the standard getBundle(String name) and
> getBundle(String name, Locale loc) factory methods and
> implements a simple
> cache using SoftReference's (btw is C2 skipping on JDK
> 1.1.x??).   There is
> a lot missing in comparison to all the things that
> java.util.ResourceBundle
> handles such as automatic ResourceBundle fallback (which
> shouldn't be too
> hard to implement) and a number of other things.
> The XMLResourceBundle class has a getString(String xPath)
> which takes an
> xPath and returns the string value of the Element that it's
> pointing to (see
> sample schema below - this needs to be determined or a better
> getString(xPath) needs to be written).   Also there is a
> getRole(String
> xPath) which returns a Node which can be passed to a
> getString(Node role,
> String key) method if you're going to be using the same Node
> over and over.
> To speed up development right now it's using the XPathAPI
> which is a sample
> class that comes with the Xalan distribution for doing XPath
> manipulation
> (today is the first day I've used the XPath API so I don't
> really know what
> I'm doing).  The method calls appear to  be very slow (it
> mentions this in
> the inline documentation) so if anyone knows anything about the XPath
> low-level API and is interested in getting the performance
> increased that
> would be great.
>
> I just wanted to get these out to anyone who might be interested....
>
> I'm using the schema that Neeme Praks had used in one of his
> emails but this
> can easily be changed:   Here's a sample resource.xml file:
>
> <?xml version="1.0"?>
> <resources xml:lang="en">
>   <forms>
>       <contacts-search>
>           <desc>
>             <searchfor>find:</searchfor>
>             <field-to-search>what:</field-to-search>
>             <from>where:</from>
>             <from-mycontacts>my contacts</from-mycontacts>
>             <from-allmembers>all members</from-allmembers>
>           </desc>
>
>           <input>
>               <field-to-search>
>                 <all>all</all>
>                 <firstname>first name</firstname>
>                 <lastname>last name</lastname>
>                 <phone>phone</phone>
>                 <email>e-mail</email>
>               </field-to-search>
>             <submit>Search</submit>
>           </input>
>       </contacts-search>
>   </forms>
> </resources>
>
>
> and sample usage:
> XMLResourceBundle bundle =
> XMLResourceBundleFactory.getBundle("resource");
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/desc/f
> rom-mycontacts"));
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/input/
> field-to-search/lastname"));
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/desc/f
> rom"));
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/input/
> field-to-search/phone"));
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/input/
> field-to-search/email"));
> System.out.println(bundle.getString("/resources/forms/contacts
> -search/desc/s
> earchfor"));
> Node role =
> bundle.getRole("/resources/forms/contacts-search/input/field-t
> o-search");
> System.out.println(bundle.getString(role, "lastname"));
> System.out.println(bundle.getString(role, "firstname"));
> System.out.println(bundle.getString(role, "phone"));
>
>
>
> Mike
>
>





Mime
View raw message