Questions tagged [markupbuilder]

66 questions
33
votes
3 answers

Detecting first and last item inside a Groovy each{} closure

I am using Groovy's handy MarkupBuilder to build an HTML page from various source data. One thing I am struggling to do nicely is build an HTML table and apply different style classes to the first and last rows. This is probably best illustrated…
tomato
  • 3,373
  • 1
  • 25
  • 33
14
votes
2 answers

How can I insert an xml comment with Groovy MarkupBuilder?

I would like to insert comments into my xml document with a Groovy MarkupBuilder. How is it possible?
jabal
  • 11,987
  • 12
  • 51
  • 99
12
votes
2 answers

Adding multiple XML elements/containers dynamically using XML MarkupBuilder in Groovy

I am trying to generate XML using Groovy MarkupBuilder. XML needed is of this form (simplified): The…
CodeVenture
  • 133
  • 1
  • 1
  • 4
11
votes
1 answer

Adding dynamic elements and attributes to groovy MarkupBuilder or StreamingMarkupBuilder

I've seen many example using Groovy's MarkupBuilder for building an XML document, but they all seem to use static attributes for every element in the document (the attribute names are all known at compile time). What if I'm trying to construct an…
pneumee
  • 113
  • 1
  • 5
6
votes
1 answer

Use of Namespaces in Groovy MarkupBuilder

I want have the following output: ZH
haschibaschi
  • 2,734
  • 23
  • 31
6
votes
2 answers

How to use Groovy XML MarkupBuilder to create valid HTML script tags?

I am using Groovy 1.8 XML MarkupBuilder to build an HTML page which includes a