public RouteTable unmarshall(StaxUnmarshallerContext context) throws Exception { RouteTable routeTable = new RouteTable(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return routeTable; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("routeTableId", targetDepth)) { routeTable.setRouteTableId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("vpcId", targetDepth)) { routeTable.setVpcId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("routeSet/item", targetDepth)) { routeTable.getRoutes().add(RouteStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("associationSet/item", targetDepth)) { routeTable .getAssociations() .add(RouteTableAssociationStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("tagSet/item", targetDepth)) { routeTable.getTags().add(TagStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("propagatingVgwSet/item", targetDepth)) { routeTable .getPropagatingVgws() .add(PropagatingVgwStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("propagatedRouteSet/item", targetDepth)) { routeTable .getPropagatedRoutes() .add(PropagatedRouteStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return routeTable; } } } }