[stringtemplate-interest] best way to expose xml in template

Nate misc at n4te.com
Tue Dec 5 17:24:16 PST 2006


Thanks for the reply.

It would be great if there were an interface that could be implemented 
that had simply #get(String). Implementing Map or extending AbstractMap 
for this is brutal. It would also be nice to see support for HashTable. 
Also Collection could be supported... $if (someSet.moo)$ would be 
equivalent to the Java: if (someSet.contains("moo"))

-Nate


Terence Parr wrote:
> On Nov 14, 2006, at 3:09 PM, Nate wrote:
>
>   
>> My application gets all of its data from a server as XML. What is a  
>> good
>> way to expose this data to my StringTemplate templates? I could use a
>> parser such as XOM, stuff the data into Lists or Maps and then push
>> those into the templates as attributes. Are there other solutions?
>>     
>
> Send in an object that implements the Map interface. In this way you  
> can ask for some named data. Would be very very sure that you have no  
> side effects in the map implementation of get().
> Ter
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>   



More information about the stringtemplate-interest mailing list