Use string.encode to encode xml