<#@ template language="C#" inherits="BaseResponseUnmarshaller"#> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <# AddLicenseHeader(); AddCommonUsingStatements(); #> namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations { /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object /// public class <#=this.UnmarshallerBaseName #>Unmarshaller : IUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext>, IUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. /// /// /// public <#=this.UnmarshallerBaseName #> Unmarshall(XmlUnmarshallerContext context) { <#=this.UnmarshallerBaseName #> unmarshalledObject = new <#=this.UnmarshallerBaseName #>(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) targetDepth += 2; while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { <# if(this.Structure != null) { foreach (var member in this.Structure.Members) { var testExpression = GeneratorHelpers.DetermineAWSQueryTestExpression(member); #> if (context.TestExpression("<#=testExpression#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; <# if (member.IsMap || member.IsList) { #> var item = unmarshaller.Unmarshall(context); unmarshalledObject.<#=member.PropertyName#>.Add(item); <# } else { #> unmarshalledObject.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); <# } #> continue; } <# } } #> } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return unmarshalledObject; } } return unmarshalledObject; } /// /// Unmarshaller error response to exception. /// /// /// public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context) { return null; } <# this.AddStructureSingletonMethod(); #> } }