[stringtemplate-interest] Top-Down automatic attribute
aggregation?
Terence Parr
parrt at cs.usfca.edu
Tue May 16 09:45:45 PDT 2006
On May 16, 2006, at 8:02 AM, Dreyer Ulf (CR/APA3) wrote:
> Hi!
Howdy! :)
> I would like to automate the process of filling templates
> with attributes.
> The scenario is as follows:
> I have one root-template which calls al other needed templates.
> The data is in tree-form analogous to the templates.
Great! Easy for ST to deal with.
> I would like to parse a xml file with all the data into the topmost
> template.
Exactly correct.
> With the automation provided by template.setAttribute I am only
> able to
> construct attributes bottom-up.
Just pass the tree in and then walk. From
http://www.cs.usfca.edu/~parrt/papers/ST.pdf
preorder(t) ::= "<t.text> <t.children:preorder()>"
ain't that sweeet! :)
> Is there some easy way to construct a full tree of data (which does
> nocht resolve
> to fixed classes with getAttribute methods) and feed it to the root
> template?
Sure. as long as it has children or some other structure.
Ter
More information about the stringtemplate-interest
mailing list