adding proper escaping into the generated xml