Can we alter MarkupBuilder to ignore optional attributes that aren't specified (contain null values).
Currently MarkupBuilder throws a NullPointerException if I create a node using attributes that contain a null map value. For example:
def writer = new StringWriter()
def builder = new MarkupBuilder(writer)
builder.A {
B {
C(D: 'E', F: null) {
}
}
}
// throws NullPointerException in MarkupBuilder.createNode
When building XML using MarkupBuilder, I find it useful to specify all attributes (required or optional) for a node in one line rather than having to implement ugly logic checks myself like follows:
builder.A {
B {
def map = [:]
if (E) {
map['D'] = 'E'
}
if (F) {
map['F'] = 'G'
}
C(map) {
}
}
}
Should be fixed in HEAD