made XML processing generic