1.Create a predefined HEADER string value for unchangeable elements of your XML
2.In your foreach loop, you can generate the required DATA results as string
3.Concatenate your DATA string inside the HEADER string
and then,you can easily convert the string as XML
--Sowraaj