grantm/xml-simple — pull request #3 by masto (2013-05-24 12:01:20+00:00)
Title: allow subclass to override attribute encoding

My application does not work correctly unless it is able to escape attribute values in such a way that whitespace is preserved, while leaving text content to the "standard" escaping. I think this is a generally useful thing to do and one of the dark corners of XML that gets forgotten about until someone puts a newline in an attribute and something breaks.

I understand your reluctance to add more options to the API, so how about this small refactoring that makes the escaping of attribute values a separate hook, so that people can at least override it in a supported way? Otherwise, the code that needs to be touched is in the middle of the large, non-public value_to_xml() routine.

I hope you will consider this pull request or an alternate approach to achieve the same end. I very much prefer to minimize the amount of monkey patching or shipping custom versions of third-party modules in my code base.

Thanks!
Chris