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

            return(instance);
        }
Beispiel #2
0
        public BlockDeviceMapping Unmarshall(XmlUnmarshallerContext context)
        {
            BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("deviceName", targetDepth))
                    {
                        blockDeviceMapping.DeviceName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ebs", targetDepth))
                    {
                        blockDeviceMapping.Ebs = EbsBlockDeviceUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("noDevice", targetDepth))
                    {
                        blockDeviceMapping.NoDevice = StringUnmarshaller.GetInstance().Unmarshall(context);

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



            return(blockDeviceMapping);
        }