I found something interesting today at work while playing with Groovy. By default, the StreamingMarkupBuilder builds empty tags like this:
but an external system that uses our API needs the tags to be expanded like this:
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:
<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 ]
← January 2021 →
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
My Blog Links
Recent Entries
-
Groovy StreamingMarkupBuilder Empty Tags
on Nov 01 2013 10:49 AM
-
-
-
-
Recent Comments
Search My Blog
0 user(s) viewing
0 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)