Array#to_xml always ignores the supplied block if the Array is empty.
There is a ticket with a patch to always yield to the block:
I added a patch that won't break the current API. It allows passing in
an ":always_yield => true" option to yield to the block even when
empty. Tests included.
Either patch would make me happy.