public DescribeSnapshotsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeSnapshotsResult describeSnapshotsResult = new DescribeSnapshotsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeSnapshotsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeSnapshotsResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Snapshots", targetDepth)) { describeSnapshotsResult.withSnapshots(new ArrayList<Snapshot>()); continue; } if (context.testExpression("Snapshots/Snapshot", targetDepth)) { describeSnapshotsResult.withSnapshots(SnapshotStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeSnapshotsResult; } } } }
public DescribeSnapshotsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeSnapshotsResult describeSnapshotsResult = new DescribeSnapshotsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeSnapshotsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeSnapshotsResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Snapshots", targetDepth)) { describeSnapshotsResult.withSnapshots(new ArrayList<Snapshot>()); continue; } if (context.testExpression("Snapshots/Snapshot", targetDepth)) { describeSnapshotsResult.withSnapshots(SnapshotStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeSnapshotsResult; } } } }