コード例 #1
0
        public static InstanceStatusDetailsUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new InstanceStatusDetailsUnmarshaller();
            }

            return(instance);
        }
コード例 #2
0
        public InstanceStatusSummary Unmarshall(XmlUnmarshallerContext context)
        {
            InstanceStatusSummary instanceStatusSummary = new InstanceStatusSummary();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("details/item", targetDepth))
                    {
                        instanceStatusSummary.Details.Add(InstanceStatusDetailsUnmarshaller.GetInstance().Unmarshall(context));

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



            return(instanceStatusSummary);
        }