public void AddMappingMetadata(CodeAttributeDeclarationCollection metadata, XmlTypeMapping mapping, string ns) {
mapping.CheckShallow();
CheckScope(mapping.Scope);
// For struct or enum mappings, we generate the XmlRoot on the struct/class/enum. For primitives
// or arrays, there is nowhere to generate the XmlRoot, so we generate it elsewhere (on the
// method for web services get/post).
if (mapping.Mapping is StructMapping || mapping.Mapping is EnumMapping) return;
AddRootMetadata(metadata, mapping.Mapping, Accessor.UnescapeName(mapping.Accessor.Name), mapping.Accessor.Namespace, mapping.Accessor);
}