Looks like you need to debug a little... add:
die($query_rsxmlorders);
That should tell you why the RS is empty... are you adding the recordset AFTER the insert details in database server behavior? If the records haven't been inserted yet, then the RS would be empty.