Test the serialized types of virtual columns in XML

The previous tests were passing, because nothing ever looked at the
generated XML. What was previously being generated was
`<firstname type="NilClass">...`, which is not consistent with all other
cases where there is not a known type.
Refactor XML serializer to not depend on `serialized_attributes`
Merge pull request #15463 from geopet/refactor_xml_compute_type

Refactor XML serializer to not depend on `serialized_attributes`