Subscribe to The Way I See It        RSS Feed
-----

Groovy StreamingMarkupBuilder Empty Tags

Icon Leave Comment
I found something interesting today at work while playing with Groovy. By default, the StreamingMarkupBuilder builds empty tags like this:

<someTag />


but an external system that uses our API needs the tags to be expanded like this:

<someTag></someTag>


There is a very simple attribute that took me more than a few minutes to find so I wanted to share it. If you do this when configuring your StreamingMarkupBuilder object, empty tags will be expanded out:

def builder = new groovy.xml.StreamingMarkupBuilder()
builder.expandEmptyElements = true

0 Comments On This Entry

 

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

August 2014

S M T W T F S
     12
3456789
10111213141516
171819 20 212223
24252627282930
31      

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)