API: Add filtering/escaping methods to Object class.

This commit adds two escaping/filtering methods to `Object` class. You
can convert any object to either XML or JavaScript escaped string. This
is done by converting the object into a string (if it's not a string
already) and then applying the escaping method on the resulting string.