private static void UnmarshallResult(XmlUnmarshallerContext context, GetAttributesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Attribute", targetDepth)) { response.Attributes.Add(AttributeUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public static AttributeUnmarshaller GetInstance() { if (instance == null) { instance = new AttributeUnmarshaller(); } return(instance); }
public Item Unmarshall(XmlUnmarshallerContext context) { Item item = new Item(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Name", targetDepth)) { item.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name/@encoding", targetDepth)) { item.AlternateNameEncoding = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Attribute", targetDepth)) { item.Attributes.Add(AttributeUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(item); } } return(item); }