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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("keyName", targetDepth))
                    {
                        launchSpecification.KeyName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("groupSet/item", targetDepth))
                    {
                        launchSpecification.AllSecurityGroups.Add(GroupIdentifierUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("groupSet/item/groupName", targetDepth))
                    {
                        launchSpecification.SecurityGroups.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("userData", targetDepth))
                    {
                        launchSpecification.UserData = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("addressingType", targetDepth))
                    {
                        launchSpecification.AddressingType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("instanceType", targetDepth))
                    {
                        launchSpecification.InstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("placement", targetDepth))
                    {
                        launchSpecification.Placement = SpotPlacementUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("kernelId", targetDepth))
                    {
                        launchSpecification.KernelId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ramdiskId", targetDepth))
                    {
                        launchSpecification.RamdiskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("blockDeviceMapping/item", targetDepth))
                    {
                        launchSpecification.BlockDeviceMappings.Add(BlockDeviceMappingUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("monitoring/enabled", targetDepth))
                    {
                        launchSpecification.MonitoringEnabled = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("subnetId", targetDepth))
                    {
                        launchSpecification.SubnetId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("networkInterfaceSet/item", targetDepth))
                    {
                        launchSpecification.NetworkInterfaces.Add(InstanceNetworkInterfaceSpecificationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("iamInstanceProfile", targetDepth))
                    {
                        launchSpecification.IamInstanceProfile = IamInstanceProfileSpecificationUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ebsOptimized", targetDepth))
                    {
                        launchSpecification.EbsOptimized = BoolUnmarshaller.GetInstance().Unmarshall(context);

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



            return(launchSpecification);
        }