private static void UnmarshallResult(XmlUnmarshallerContext context, GetDistributionResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Distribution", targetDepth)) { response.Distribution = DistributionUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("ETag")) { response.ETag = responseData.GetHeaderValue("ETag"); } return; }
public GetDistributionResult Unmarshall(XmlUnmarshallerContext context) { GetDistributionResult getDistributionResult = new GetDistributionResult(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Distribution", targetDepth)) { getDistributionResult.Distribution = DistributionUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(getDistributionResult); } } getDistributionResult.ETag = context.Headers["ETag"]; return(getDistributionResult); }
public static DistributionUnmarshaller GetInstance() { if (instance == null) { instance = new DistributionUnmarshaller(); } return(instance); }