/// <summary>
        /// Build error response.
        /// </summary>
        /// <param name="errorCode">
        /// The error code.
        /// </param>
        /// <returns>
        /// The <see cref="Error"/>.
        /// </returns>
        public Error BuildErrorResponse(SdmxErrorCode errorCode)
        {
            var errorDoc = new Error();
            ErrorType error = errorDoc.Content;

            // FUNC Standard error codes
            var errorMessage = new CodedStatusMessageType();
            error.ErrorMessage.Add(errorMessage);
            errorMessage.code = errorCode.ClientErrorCode.ToString(CultureInfo.InvariantCulture);
            var text = new TextType();
            errorMessage.Text.Add(text);
            text.TypedValue = errorCode.ErrorString;
            return errorDoc;
        }
        /// <summary>
        /// Build error response.
        /// </summary>
        /// <param name="exception">
        /// The exception.
        /// </param>
        /// <returns>
        /// The <see cref="Error"/>.
        /// </returns>
        public Error BuildErrorResponse(Exception exception)
        {
            var errorDoc = new Error();
            ErrorType error = errorDoc.Content;

            // FUNC Standard error codes
            var errorMessage = new CodedStatusMessageType();
            error.ErrorMessage.Add(errorMessage);
            errorMessage.code = "1000";
            var text = new TextType();
            errorMessage.Text.Add(text);
            var uncheckedException = exception as SdmxException;
            text.TypedValue = uncheckedException != null ? uncheckedException.FullMessage : exception.Message;

            return errorDoc;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="TextTypeWrapperImpl"/> class.
        /// </summary>
        /// <param name="textType">
        /// The text type. 
        /// </param>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        public TextTypeWrapperImpl(TextType textType, ISdmxObject parent)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.TextType), parent)
        {
            this.Locale = textType.lang;
            this.Value = textType.TypedValue;
            this.Validate();
        }
 /// <summary>
 /// Gets the <see cref="TextType"/> from the specified <paramref name="englishString"/>
 /// </summary>
 /// <param name="englishString">
 /// The text
 /// </param>
 /// <returns>
 /// The the <see cref="TextType"/> from the specified <paramref name="englishString"/>
 /// </returns>
 internal TextType GetTextType(string englishString)
 {
     var tt = new TextType { lang = DefaultLang, TypedValue = englishString };
     return tt;
 }
 /// <summary>
 /// Gets the <see cref="TextType"/> from the specified <paramref name="textTypeWrapper"/>
 /// </summary>
 /// <param name="textTypeWrapper">
 /// The text Type Wrapper
 /// </param>
 /// <returns>
 /// The the <see cref="TextType"/> from the specified <paramref name="textTypeWrapper"/>
 /// </returns>
 internal TextType GetTextType(ITextTypeWrapper textTypeWrapper)
 {
     var tt = new TextType { lang = textTypeWrapper.Locale, TypedValue = textTypeWrapper.Value };
     return tt;
 }
        /// <summary>
        /// Gets the <see cref="Org.Sdmx.Resources.SdmxMl.Schemas.V21.Common.TextType"/> from the specified
        ///     <paramref name="textTypeWrappers"/>
        /// </summary>
        /// <param name="textTypeWrappers">
        /// The text Type Wrappers
        /// </param>
        /// <returns>
        /// The the <see cref="Org.Sdmx.Resources.SdmxMl.Schemas.V21.Common.TextType"/> from the specified
        ///     <paramref name="textTypeWrappers"/>
        /// </returns>
        internal TextType[] GetTextType(IList<ITextTypeWrapper> textTypeWrappers)
        {
            if (!ObjectUtil.ValidCollection(textTypeWrappers))
            {
                return null;
            }

            var textTypes = new TextType[textTypeWrappers.Count];
            for (int i = 0; i < textTypeWrappers.Count; i++)
            {
                TextType tt = this.GetTextType(textTypeWrappers[i]);
                textTypes[i] = tt;
            }

            return textTypes;
        }