velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Glass-Husain <wgl...@forio.com>
Subject Re: Extracting a list of keys from a string based template
Date Thu, 20 Jul 2006 12:58:29 GMT
Hi Mike,

First, a quick side comment.  Velocity.evaluate() does work fine.  But 
if you are calling Velocity repeatedly, consider using a resource loader 
like FileResourceLoader or ClasspathResourceLoader.  The caching 
mechanism in the resource loader speeds up things tremendously.

Velocity is more aimed at generating the text rather than parsing it.  
It doesn't contain much in the way of identifying content.  It's 
possible you might load the file in a resource loader, take the returned 
Template object, and break it down into to the constituent parsed 
nodes.  But since this is essentially an internal structure, the 
specific node types it might change in future versions.

WILL

Smith, Mike H wrote:
> Hi, 
>
>  
>
> I'm a Velocity newbie, and am evaluating to see if it can address our
> relatively simple requirements.
>
>  
>
> I need to use String based templates. After a bit if digging around I
> found the following function:
>
>  
>
> Velocity.evaluate( context, writer, "", templateString );
>
>           
>
> This works pretty well for our purposes.
>
>  
>
> However I also need to get a list of candidate keys from the template
> String.
>
>  
>
> So if my template contains: "$a $b" I need to extract ["a","b"].
>
>  
>
> Thanks.
>
> Mike
>
>  
>
>
>   

-- 
Forio Business Simulations

Will Glass-Husain
phone (415) 440-7500 x89
mobile (415) 235-4293
wglass@forio.com
www.forio.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message