public DescribeTagsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeTagsResult describeTagsResult = new DescribeTagsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeTagsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("TaggedResources", targetDepth)) { describeTagsResult.withTaggedResources(new ArrayList<TaggedResource>()); continue; } if (context.testExpression("TaggedResources/TaggedResource", targetDepth)) { describeTagsResult.withTaggedResources(TaggedResourceStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Marker", targetDepth)) { describeTagsResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeTagsResult; } } } }
public DescribeTagsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeTagsResult describeTagsResult = new DescribeTagsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeTagsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("TaggedResources", targetDepth)) { describeTagsResult.withTaggedResources(new ArrayList<TaggedResource>()); continue; } if (context.testExpression("TaggedResources/TaggedResource", targetDepth)) { describeTagsResult.withTaggedResources(TaggedResourceStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Marker", targetDepth)) { describeTagsResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeTagsResult; } } } }