proper way of escaping post data before converting to XML
<p>I have a big multi dimensional array which has a lot of different type of data from string to int and all that data has is converted to xml and send to third party to parse and do nasty things with it.</p>

<p>My current goal is to clean the array of possible sql injection, since we don't now what kind of protection they have on there side.</p>

<p>Can somebody give suggestion how to properly escape/convert any characters inside the array before convert it to xml.</p>

<p>I will use a function with recursive to loop trough array.
So I need tips and tricks what my function will do to parameters.
Since the information I found is overwhelming and many exceptions exist.</p>