Sunday, September 25, 2011

Groovy is fun!


Just played around with a few xml and Groovy( i think it has a very short learning curve, i could follow the code,even though i ve no much experience in it), its first class support to xml is brilliant .

Just
def writer = new StringWriter();
def builder = new MarkupBuilder(writer);
builder.root {
child {
title "Child 1"
}
}
println(writer);  

This is enough to build a small xml file. Parsing is also fun( have tried XmlSlurper). Since they are plain java byte codes after compilation, only an additional groovy library is enough for calling these utilities from our java application.Groovy can be handy if we want to write some fast utility classes(In fact, we can call it as Super Java). Java + Groovy DSL is fun. Now planning to compose a full fledged xml utility class with groovy.


No comments:

Post a Comment