Corrected and speeded up primo xml parser