private static void UnmarshallResult(XmlUnmarshallerContext context, GetACLResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Owner", targetDepth)) { if (null == response.AccessControlList) { response.AccessControlList = new S3AccessControlList(); } response.AccessControlList.Owner = OwnerUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Grant", targetDepth + 1)) { if (null == response.AccessControlList) { response.AccessControlList = new S3AccessControlList(); } response.AccessControlList.Grants.Add(GrantUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public S3BucketLoggingConfig Unmarshall(XmlUnmarshallerContext context) { S3BucketLoggingConfig loggingEnabled = new S3BucketLoggingConfig(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("TargetBucket", targetDepth)) { loggingEnabled.TargetBucketName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Grant", targetDepth + 1)) { loggingEnabled.Grants.Add(GrantUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("TargetPrefix", targetDepth)) { loggingEnabled.TargetPrefix = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(loggingEnabled); } } return(loggingEnabled); }