Encodes and decodes xml text for Ruby