What you are describing with class A is a "factory" (Look up "Factory Pattern") and through Attributes you can control how things are displayed when serialized into XML.
However it's still a little unclear of what your goals are:
Can you describe what you are doing with the XML output?
Part of the point of serialization is to be able to be reconstructed - so if two different classes actually have the same name, then one of them will not be able to be re-constructed through typical deserialization. So there might be another solution for your needs if you want to give a little more information.