public GetDistributionConfigResult Unmarshall(XmlUnmarshallerContext context)
        {
            GetDistributionConfigResult getDistributionConfigResult = new GetDistributionConfigResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("DistributionConfig", targetDepth))
                    {
                        getDistributionConfigResult.DistributionConfig = DistributionConfigUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(getDistributionConfigResult);
                }
            }


            getDistributionConfigResult.ETag = context.Headers["ETag"];


            return(getDistributionConfigResult);
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetDistributionConfigResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("DistributionConfig", targetDepth))
                    {
                        response.DistributionConfig = DistributionConfigUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }


            IWebResponseData responseData = context.ResponseData;

            if (responseData.IsHeaderPresent("ETag"))
            {
                response.ETag = responseData.GetHeaderValue("ETag");
            }


            return;
        }
        public static DistributionConfigUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new DistributionConfigUnmarshaller();
            }

            return(instance);
        }
        public Distribution Unmarshall(XmlUnmarshallerContext context)
        {
            Distribution distribution  = new Distribution();
            int          originalDepth = context.CurrentDepth;
            int          targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Id", targetDepth))
                    {
                        distribution.Id = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Status", targetDepth))
                    {
                        distribution.Status = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("LastModifiedTime", targetDepth))
                    {
                        distribution.LastModifiedTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("InProgressInvalidationBatches", targetDepth))
                    {
                        distribution.InProgressInvalidationBatches = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DomainName", targetDepth))
                    {
                        distribution.DomainName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ActiveTrustedSigners", targetDepth))
                    {
                        distribution.ActiveTrustedSigners = ActiveTrustedSignersUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DistributionConfig", targetDepth))
                    {
                        distribution.DistributionConfig = DistributionConfigUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(distribution);
                }
            }



            return(distribution);
        }