示例#1
0
        public static SubnetUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new SubnetUnmarshaller();
            }

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

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

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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("Subnets/Subnet", targetDepth))
                    {
                        cacheSubnetGroup.Subnets.Add(SubnetUnmarshaller.GetInstance().Unmarshall(context));

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



            return(cacheSubnetGroup);
        }