public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { GetConsoleOutputResponse response = new GetConsoleOutputResponse(); int targetDepth = 2; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("instanceId", targetDepth)) { response.InstanceId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("timestamp", targetDepth)) { response.Timestamp = DateTimeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("output", targetDepth)) { response.Output = StringUnmarshaller.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) { GetConsoleOutputResponse response = new GetConsoleOutputResponse(); 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("instanceId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.InstanceId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("output", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Output = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("timestamp", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.Timestamp = unmarshaller.Unmarshall(context); continue; } } } return(response); }