Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

I find it easier to understand concrete examples so I will start by using a standard builder MarkupBuilder; so let us see it in use:

Code Block
borderStylesolid
titleMarkupBuilder Example
borderStylesolid
// create a builder, (note: this is not in one of the packages that are automatically imported

def builder = new groovy.xml.MarkupBuilder()  // construct a builder step(1)

// create a simple xml markup

builder.stocks {                              // step (2)
    stock(symbol: 'JAVA')                     // step (3-1)
    stock(symbol: 'MSFT')                     // step (3-2)
    stock(symbol: 'IBM' )
}


==== result output =====>
<stocks>
  <stock symbol='JAVA' />
  <stock symbol='MSFT' />
  <stock symbol='IBM' />
</stocks>

...