Monday, February 05, 2007

Flattening Xml to Map using depthFirst

It's very wonderful and extremely easy to use groovy.xml.XmlParser to flatten an XML document into a Grails compatible Map:


def Map xmlToMap(String xml) {
def root = new XmlParser().parseText(xml)
def map = [:]
root.depthFirst().each { n ->
if(n.value.size == 1) {
def key = n.name
def p = n.parent
while(p.parent != null) {
key = "${p.name}.${key}"
p = p.parent
}
map[key] = n.value[0]
}
}
return map
}

Sunday, February 04, 2007

Multiple Assignment soon in Groovy 1.1

Beside other cool features, the last entry in GDC 3 report about what's going to be added into Groovy 1.1 is multiple assignment. I'm definitely looking forward to use it !!!

GORM and Data Grid

Graeme Rocher revealed the possibility for GORM to support data grid on top of Terracotta or Tangasol Coherence.

This's going to be a big impact, at least, from my research perspective.

Groovy is the most interesting JVM-based non-Java language

By Java.net poll, Groovy gets 27.3% and becomes the most interesting non-Java language running on JVM. However, JRuby ranks no. 2 with 20.9%.

This survey gives a good picture of Groovy, and of course Grails, momentum.