If the Namespace enum stored the reference to the corresponding parser, then you can iterate over the namespaces and perform this registration dynamically.