CRM-14478, CRM-14474 - Move XML lookup code into new class