My proposed fix for Scala bug #1118 (serialization of empty elements)

No replies

Sun, 2010-03-28, 07:21

Alex Cruise

Joined: 2008-12-17,

Hey folks,

Here's the latest version of my proposed fix for #1118. I'd really like
to get some review before I commit it. Lift is CC'd as you guys are
most likely to be impacted by this change if it goes in, and scala-user
because I crave attention. ;)

* Elements that were originally parsed as minimized (i.e. rather
than ) will be serialized in their original form. Currently
is serialized to . I think we can all agree that this
is, uh... wicked suboptimal. ;)

* Elem gets a new constructor and factory method that allow the
minimization behaviour to be chosen explicitly for any Elem that's built
programatically: pass minimizeEmpty = true to indicate that you'd like
this Elem to be serialized in minimized form if empty, and false otherwise.

* Utility.toXML is deprecated because of its all-or-nothing approach to
minimizeTags. Unfortunately I couldn't just add an overload because
overloading is incompatible with named and default arguments. It calls
through to a new method Utility.serialize, which is otherwise identical
except that rather than a Boolean, its minimizeTags parameter must be
one of the following enum values: