Well all depends on what version of php our running.
There are some good XML parsing functions built into php5.
In PHP4 - you could use the PEAR XML_Serializer class.
Which converts arrays into XML and vice versa - so you could get your recordset as an array and pop it through the serializer.