Exemple #1
0
        public static RouteUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new RouteUnmarshaller();
            }

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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("routeSet/item", targetDepth))
                    {
                        routeTable.Routes.Add(RouteUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("associationSet/item", targetDepth))
                    {
                        routeTable.Associations.Add(RouteTableAssociationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("tagSet/item", targetDepth))
                    {
                        routeTable.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("propagatingVgwSet/item", targetDepth))
                    {
                        routeTable.PropagatingVgws.Add(PropagatingVgwUnmarshaller.GetInstance().Unmarshall(context));

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



            return(routeTable);
        }