String doesn't respond to to_xml -- should it?

Hey everyone,

I was poking around with to_xml today, and I was semi-surprised to see
the "not all elements respond to to_xml" message... I had an array of

My first suggestion is that String would just replace the basic entity
chars that XML defines, much like ERB::Util#html_escape:

& ==> &
< ==> &lt;

==> &gt;

" ==> &quot;
' ==> &apos;

#html_escape would cover this except for the &apos; case, which
appears to be needed as well.

Any opinions? Patch + tests would be pretty easy to supply :slight_smile:



Retracted.. Strings passed to builder are xml-escaped, so I'll write a
custom #to_xml for a wrapper object.. sorry for the noise :wink: