public Address unmarshall(StaxUnmarshallerContext context) throws Exception { Address address = new Address(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return address; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("instanceId", targetDepth)) { address.setInstanceId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("publicIp", targetDepth)) { address.setPublicIp(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("allocationId", targetDepth)) { address.setAllocationId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("associationId", targetDepth)) { address.setAssociationId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("domain", targetDepth)) { address.setDomain(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("networkInterfaceId", targetDepth)) { address.setNetworkInterfaceId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("networkInterfaceOwnerId", targetDepth)) { address.setNetworkInterfaceOwnerId( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("privateIpAddress", targetDepth)) { address.setPrivateIpAddress(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return address; } } } }