[antlr-interest] reading a template from a file using StringTemplate

John D. Mitchell johnm-antlr at non.net
Fri Nov 12 09:12:43 PST 2004


>>>>> "Sean" == Sean Barry <seanharteb at yahoo.co.uk> writes:
> Hey I have read through the documentation on StringTemplate but I'm still
> having problems with reading a basic template from a file, I think my
> template setup may be the problem.

> Invoking Java code:

> StringTemplateGroup group = new
> StringTemplateGroup("myGroup","/Templates" ); StringTemplate query =
> group.getInstanceOf("sql_statement"); query.setAttribute("column",
> "basic_col1"); query.setAttribute("table", "basic_table1");
> System.out.println(query.toString() );

> and I have a basic SQL template in a text file ("sql_statements.st"):
> SELECT $column; separator=","$ FROM $table$;

> any possible reasons for my runtime error would be appreciated Regards

(A) What's the run-time error?

(B) Is there some reason that you're not checking the return values for
e.g., null from getInstanceOf()?

(C) Is the template actually in the /Templates directory?  Note that in my
usage, I'm getting having it get templates via the classpath and I'm using
full path names for all of the templates.

Take care,
	John


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list