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

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

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Grantee", targetDepth))
                    {
                        grant.Grantee = GranteeUnmarshaller.GetInstance().Unmarshall(context);

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

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



            return(grant);
        }