non usare htmlspecialchars_decode e invece metti tutti i dati di tipo stringa dentro cdata http://www.w3schools.com/xml/xml_cdata.asp