/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { PurchaseHostReservationResponse response = new PurchaseHostReservationResponse(); 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("clientToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ClientToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("currencyCode", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CurrencyCode = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("purchase/member", targetDepth)) { var unmarshaller = PurchaseUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Purchase.Add(item); continue; } if (context.TestExpression("totalHourlyPrice", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.TotalHourlyPrice = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("totalUpfrontPrice", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.TotalUpfrontPrice = unmarshaller.Unmarshall(context); continue; } } } return response; }