2010-10-26 12 views

Répondre

20

Vous pouvez utiliser mkp.comment comme ceci:

def writer = new StringWriter() 
def builder = new groovy.xml.MarkupBuilder(writer) 
builder.cars { 
    mkp.comment "A comment" 
    ford(type:'escort') 
    ford(type:'fiesta') 
} 

println writer 

qui imprime:

<cars><!-- A comment --> 
    <ford type='escort' /> 
    <ford type='fiesta' /> 
</cars> 

Les mkp.XXX méthodes sont described here

+0

merci tim, ça marche! – jabal