public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeSnapshotAttributeResponse response = new DescribeSnapshotAttributeResponse(); int targetDepth = 2; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("snapshotId", targetDepth)) { response.SnapshotId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("createVolumePermission/item", targetDepth)) { response.CreateVolumePermissions.Add(CreateVolumePermissionUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("productCodes/item", targetDepth)) { response.ProductCodes.Add(ProductCodeUnmarshaller.GetInstance().Unmarshall(context)); continue; } } } return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeSnapshotAttributeResponse response = new DescribeSnapshotAttributeResponse(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth = 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("createVolumePermission/item", targetDepth)) { var unmarshaller = CreateVolumePermissionUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.CreateVolumePermissions.Add(item); continue; } if (context.TestExpression("productCodes/item", targetDepth)) { var unmarshaller = ProductCodeUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ProductCodes.Add(item); continue; } if (context.TestExpression("snapshotId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SnapshotId = unmarshaller.Unmarshall(context); continue; } } } return(response); }