Escape according to Canonical XML 1.0

First and foremost, this change allows adding linefeeds, tabs and carriage returns to attribute values.  This was not possible before, since such characters did not get escaped and without escaping a conforming XML reader [will replace them by blanks](http://www.w3.org/TR/2004/REC-xml-20040204/#AVNormalize).

While at it, this change escapes attribute values, text, and comments according to the [Canonical XML 1.0 specification](http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping).  In particular, in attribute values greater-than and single quote no longer get escaped; in element values, single and double quotes no longer get escaped but carriage return does get escaped; and in comments, nothing gets escaped.