Return to Snippet

Revision: 21934
at December 24, 2009 10:13 by javadude


Updated Code
def fw = new FileWriter("/somepath/persons.xml" )
// to write to standard out, remove fw
def xml = new groovy.xml.MarkupBuilder(fw)

xml.content() {
    xml.parameter(x:0)
    xml.person(id:100){
      firstname("John")
      lastname("Long")
    }    
    xml.person(id:101){
      firstname("Ken")
      lastname("Smith")
    }
}

Revision: 21933
at December 24, 2009 10:08 by javadude


Initial Code
def fw = new FileWriter("/somepath/persons.xml" )

// to write to standard out, remove fw
def xml = new groovy.xml.MarkupBuilder(fw)

xml.content() {

    xml.parameter(x:0)
    
    xml.person(id:100){
      firstname("John")
      lastname("Long")
    }
    
    xml.person(id:101){
      firstname("Ken")
      lastname("Smith")
    }
}

Initial URL


Initial Description


Initial Title
Create simple XML with MarkupBuilder

Initial Tags
xml, groovy

Initial Language
Groovy