Alex - I think VelocityEngine.evaluate() will do what you need if you wrap the input 
String with a StringReader. Since you say you're reading from a Jar you may want to do 
something like this:

Reader r = new InputStreamReader(
    ClassLoader.getSystemClassLoader().getResourceAsStream("your-template-path-here"));

Writer w = new StringWriter();

boolean ok = velocityEngine.evaluate(velocityContext, w, "logtag", r);

String output = w.toString();

--Pete

> -----Original Message-----
> From: Alex [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 08, 2004 11:24 PM
> To: [EMAIL PROTECTED]
> Subject: Parsing a string
> 
> 
> Is it possible to parse a String containing a template using 
> the current 
> context? Basically I want to do exactly what #parse does, 
> except I want to 
> pass in a String containing the template rather than a 
> template file name. 
> I could probably generate a temporary file and then call 
> parse on that, but 
> I'm not sure where to put the generated template so that 
> #parse  could find 
> it. My templates are inside of a jar file and I do not have 
> access to the 
> code that creates the context and runs Velocity. Any 
> ideas/help is greatly 
> appreciated.
> 
> Thanks,
> Alex Figliolia
>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to