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

            return(instance);
        }
示例#2
0
        public AvailabilityZone Unmarshall(XmlUnmarshallerContext context)
        {
            AvailabilityZone availabilityZone = new AvailabilityZone();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("zoneState", targetDepth))
                    {
                        availabilityZone.State = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("regionName", targetDepth))
                    {
                        availabilityZone.RegionName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("messageSet/item", targetDepth))
                    {
                        availabilityZone.Messages.Add(AvailabilityZoneMessageUnmarshaller.GetInstance().Unmarshall(context));

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



            return(availabilityZone);
        }