public Credentials unmarshall(StaxUnmarshallerContext context) throws Exception { Credentials credentials = new Credentials(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return credentials; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("AccessKeyId", targetDepth)) { credentials.setAccessKeyId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("SecretAccessKey", targetDepth)) { credentials.setSecretAccessKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("SessionToken", targetDepth)) { credentials.setSessionToken(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Expiration", targetDepth)) { credentials.setExpiration(DateStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return credentials; } } } }
public DecodeAuthorizationMessageResult unmarshall(StaxUnmarshallerContext context) throws Exception { DecodeAuthorizationMessageResult decodeAuthorizationMessageResult = new DecodeAuthorizationMessageResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return decodeAuthorizationMessageResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("DecodedMessage", targetDepth)) { decodeAuthorizationMessageResult.setDecodedMessage( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return decodeAuthorizationMessageResult; } } } }