[stringtemplate-interest] Top-Down automatic attributeaggregation?

Dreyer Ulf (CR/APA3) Ulf.Dreyer at de.bosch.com
Wed May 17 23:45:08 PDT 2006


Hello Terence,

thank you again for another quick answer (minus several
hours of time difference).
One last (I hope) call to you if I got the idea right
or if I am violating ST in every possible way.
I've been looking into ST only the past few days and
don't want to end up on thedailywtf.com because of
my lack of understanding about it ;) 

[...] see old mails
> > The actual classes to hold the XML-data have
> > to be generic with some kind of getAttributeByName(String: aName);
> 
> You should probably structure it so that the children are in a map.   
> You can then say: $node.child$ to get the child subtree.
[...]
> 
> Yeah, i'd go with the map.  Might have to wrap those objects if you  
> have no control over them to change their implementation.

I think, I've worked it out. After looking closely at StringTemplate.cs
I now create a tree structure of alternating Hashtables and ArrayLists 
and put them into the root-templaty via rootTemplate.Attributes=XYZ
(this is a public r/w property in the c# implementation - I haven't 
testet in Java)

XYZ = Hashtable[AttributeA,AttributeB,AttributeC]
AttributeA = ArrayList[Hashtable[AttributeAA,AttributeAB...]
AttributeB = ArrayList[Hashtable[AttributeBA,AttributeBB...]

Here is the part where you scream "NOOOO! It wasn't meant that way!"
Or - better yet - say "That's what I meant"

Bye,

Ulf

P.S. I really hope I made less typos than I did yesterday even though
     it's just as early.


More information about the stringtemplate-interest mailing list