Weird NodeBuilder and GPath behaviour in Grails

Posted by yogiebiz on Stack Overflow See other posts from Stack Overflow or by yogiebiz
Published on 2010-05-28T13:08:48Z Indexed on 2010/05/28 13:12 UTC
Read the original article Hit count: 192

Filed under:
|

Hi,

I am quite new with Grails and now I have a problem while using NodeBuilder and GPath. Here is the code snippet

def builder = new NodeBuilder()
def menu = builder.menu {
    header(title: "header 1") {
       submenu(title: "submenu 1.1")
       submenu(title: "submenu 1.2")
    }
    header(title: "header 2")
}

menu.grep {
println it.'@title'

When I executed it with Groovy 1.7.2, the result was:

header 1
header 2

which just like I expected. But when I executed the code in Grails 1.3.1, the result was different. The result was:

submenu 1.1
submenu 1.2

any idea why this happened?

© Stack Overflow or respective owner

Related posts about grails

Related posts about groovy