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

            return(instance);
        }
Exemple #2
0
        public ValidateTemplateResult Unmarshall(XmlUnmarshallerContext context)
        {
            ValidateTemplateResult validateTemplateResult = new ValidateTemplateResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Parameters/member", targetDepth))
                    {
                        validateTemplateResult.Parameters.Add(TemplateParameterUnmarshaller.GetInstance().Unmarshall(context));

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

                        continue;
                    }
                    if (context.TestExpression("Capabilities/member", targetDepth))
                    {
                        validateTemplateResult.Capabilities.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

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

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



            return(validateTemplateResult);
        }