How does one insert an entity into an attribute, without XML::Writer converting the & into & ? It seems hardcoded to convert all '&', whether they are part of an entity or not.
It should reference the DTD to find out about known entities, or at least accept a list of entities to not reencode. Or, as I have done, not encode anything that matches /\&\S\;/
Also, XML::Writer is extremely subclassing-hostile - it would be easy enough to subclass it and override the _escapeLiteral method, except the way it's been written it's not easy, and I've ended up having to take a copy of the entire module and hack it. Messy !