/// <summary>
        /// The process structure map.
        /// </summary>
        /// <param name="structureSetType">
        /// The structure set type.
        /// </param>
        /// <param name="buildFrom">
        /// The build from.
        /// </param>
        private void ProcessStructureMap(StructureSetType structureSetType, IStructureMapObject buildFrom)
        {
            var structureMapType = new StructureMapType();
            structureSetType.StructureMap = structureMapType;

            structureMapType.isExtension = buildFrom.Extension;

            string str0 = buildFrom.Id;
            if (!string.IsNullOrWhiteSpace(str0))
            {
                structureMapType.id = buildFrom.Id;
            }

            IList<ITextTypeWrapper> names = buildFrom.Names;
            if (ObjectUtil.ValidCollection(names))
            {
                structureMapType.Name = this.GetTextType(names);
            }

            IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions;
            if (ObjectUtil.ValidCollection(descriptions))
            {
                structureMapType.Description = this.GetTextType(descriptions);
            }

            if (buildFrom.SourceRef != null)
            {
                if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.Dsd)
                {
                    var keyFamilyRef = new KeyFamilyRefType();
                    structureMapType.KeyFamilyRef = keyFamilyRef;
                    SetDataStructureRefAttributes(keyFamilyRef, buildFrom.SourceRef);
                }
                else if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.Msd)
                {
                    var refType = new MetadataStructureRefType();
                    structureMapType.MetadataStructureRef = refType;
                    SetMetadataStructureRefAttributes(refType, buildFrom.SourceRef);
                }
            }

            if (buildFrom.TargetRef != null)
            {
                if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.Dsd)
                {
                    var keyFamilyRef = new KeyFamilyRefType();
                    structureMapType.TargetKeyFamilyRef = keyFamilyRef;
                    SetDataStructureRefAttributes(keyFamilyRef, buildFrom.TargetRef);
                }
                else if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.Msd)
                {
                    var refType1 = new MetadataStructureRefType();
                    structureMapType.TargetMetadataStructureRef = refType1;
                    SetMetadataStructureRefAttributes(refType1, buildFrom.TargetRef);
                }
            }

            IList<IComponentMapObject> componentMapObjects = buildFrom.Components;
            if (ObjectUtil.ValidCollection(componentMapObjects))
            {
                /* foreach */
                foreach (IComponentMapObject componentMapBean in componentMapObjects)
                {
                    var componentMapType = new ComponentMapType();
                    structureMapType.ComponentMap.Add(componentMapType);
                    this.ProcessComponent(componentMapType, componentMapBean);
                }
            }

            if (this.HasAnnotations(buildFrom))
            {
                structureMapType.Annotations = this.GetAnnotationsType(buildFrom);
            }
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentMapCore"/> class.
        /// </summary>
        /// <param name="compMap">
        /// The comp map. 
        /// </param>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        /// <exception cref="SdmxSemmanticException">
        /// Throws Validate exception.
        /// </exception>
        protected internal ComponentMapCore(ComponentMapType compMap, IStructureMapObject parent)
            : base(null, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CategoryMap), parent)
        {
            this.mapConceptRef = compMap.Source.GetTypedRef<LocalComponentListComponentRefType>().id;
            this.mapTargetConceptRef = compMap.Target.GetTypedRef<LocalComponentListComponentRefType>().id;
            if (compMap.RepresentationMapping != null)
            {
                this.repMapRef = new RepresentationMapRefCore(compMap.RepresentationMapping, this);
            }

            try
            {
                this.Validate();
            }
            catch (SdmxSemmanticException e)
            {
                throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this);
            }
        }
        /// <summary>
        /// The process component.
        /// </summary>
        /// <param name="componentMapType">
        /// The component map type.
        /// </param>
        /// <param name="componentMapBean">
        /// The component map bean.
        /// </param>
        private void ProcessComponent(ComponentMapType componentMapType, IComponentMapObject componentMapBean)
        {
            if (componentMapBean.MapConceptRef != null)
            {
                componentMapType.MapConceptRef = componentMapBean.MapConceptRef;
            }

            if (componentMapBean.MapTargetConceptRef != null)
            {
                componentMapType.MapTargetConceptRef = componentMapBean.MapTargetConceptRef;
            }

            if (componentMapBean.RepMapRef != null)
            {
                if (componentMapBean.RepMapRef.ToTextFormat != null)
                {
                    var textForamtType = new TextFormatType();
                    componentMapType.ToTextFormat = textForamtType;
                    this.PopulateTextFormatType(textForamtType, componentMapBean.RepMapRef.ToTextFormat);
                }

                switch (componentMapBean.RepMapRef.ToValueType)
                {
                    case ToValue.Description:
                        componentMapType.ToValueType = ToValueTypeTypeConstants.Description;
                        break;
                    case ToValue.Name:
                        componentMapType.ToValueType = ToValueTypeTypeConstants.Name;
                        break;
                    case ToValue.Value:
                        componentMapType.ToValueType = ToValueTypeTypeConstants.Value;
                        break;
                }
            }
        }