Hi Peter, you seem to be seeking to list the references in your templates... The TemplateTool should help you here:
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/experimental/templatetool/TemplateTool.java?revision=HEAD Nathan gave pointers how to load a template from a string. Cheers, Christoph [EMAIL PROTECTED] wrote: > Hi, > Let me explain. I refer to "dynamic template" from the velocity > documentation (template = Velocity.getTemplate("mytemplate.vm")) //non > dynamic template; > > > I try to illustrate what I want to do with the following fictional code > snippet: > > String string = "<html><body>\nHello $apa</body></html>"; > > attributes[] = Velocity.getTemplateFromStringReader(new > StringReader(string)).extractAllPossibleVariableNamesInTemplate(); > for(int i=0;i<attributes.length;i++) { > System.out.println(attributes[i].getName()); // Would print $apa > or apa > } > > I hope this clarify what I want to do.. I guess I have to go really low > level interacting with the Parser or something similar to accomplish > this? > > Peter > > > -----Original Message----- > From: Nathan Bubna [mailto:[EMAIL PROTECTED] > Sent: den 28 november 2006 18:28 > To: Velocity Developers List > Subject: Re: Extracting tokens > > what do you mean by "dynamic template"? > > On 11/28/06, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: >> Thanks alot! Is this possible to do with dynamic templates? >> I havent seen a way for getting the Template object from a dynamic >> template. >> >> Peter Larnholt >> >> >> >> -----Original Message----- >> From: Nathan Bubna [mailto:[EMAIL PROTECTED] >> Sent: den 28 november 2006 17:44 >> To: Velocity Developers List >> Subject: Re: Extracting tokens >> >> http://svn.apache.org/repos/asf/jakarta/velocity/engine/trunk/experime >> nt >> al/templatetool/ >> >> On 11/28/06, [EMAIL PROTECTED] >> <[EMAIL PROTECTED]> wrote: >>> Hello, >>> >>> I'm a velocity newbie. We have a portal framework with a propretary >> MVC. >>> We are thinking of using velocity for rendering the views. In our >>> publishing tool we need to extract all defined variables from a >>> template. Reading the documentation I cannot find this. A lot of >>> information exists to do the other way around (extract objects into >>> Context variables). >>> >>> Anyone that could give me some pointers. >>> >>> What I'm looking for really is someting like; variables[] = >>> Velocity.getTemplate("mytemplate.vm").extractAllPossibleVariableName >>> sI >>> nT >>> emplate(); >>> >>> Cheers. >>> Peter >>> >>> >>> -------------------------------------------------------------------- >>> - 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] >> >> >> --------------------------------------------------------------------- >> 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] > > > --------------------------------------------------------------------- > 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]
