[antlr-interest] StringTemplate
Terence Parr
parrt at cs.usfca.edu
Sat May 1 14:20:01 PDT 2004
On May 1, 2004, at 1:32 PM, william_surowiec wrote:
> I am having conceptual problems in approaching a task on which I
> believe StringTemplate (ST hereafter) would be excellent.
>
> I will be creating an "xml-ish" view of a complex Java object. Make
> believe the example of "persons" in the documentation for ST was
> richer. Imagine, in addition to name and age, each person had zero or
> more courses taken while in school. Getting more complex, imagine,
> for each course, the person may have taken it one or more times (God
> knows I did). Lastly, imagine any person may have attended zero or
> more schools.
>
> I can build a Java bean, containing collections of other beans,
> containing other beans, ..., expressing this collection of stuff. But
> I do not see how I can get ST to process this structure - unless I am
> missing something.
Hi Bill,
Does the hierarchical menu example in the paper help at all?
Essentially, you would ask for
person.courses
which returns a list of courses via person.getCourses(). You can apply
a template to each course:
person.courses:course()
where course template might look like:
attr.name:bold()<br>
attr.attempt<br>
attr.school:terseSchoolView()
etc...
Does that get you started?
Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing
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