public SendMessageBatchRequestEntry unmarshall(StaxUnmarshallerContext context) throws Exception { SendMessageBatchRequestEntry sendMessageBatchRequestEntry = new SendMessageBatchRequestEntry(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return sendMessageBatchRequestEntry; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Id", targetDepth)) { sendMessageBatchRequestEntry.setId( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("MessageBody", targetDepth)) { sendMessageBatchRequestEntry.setMessageBody( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("DelaySeconds", targetDepth)) { sendMessageBatchRequestEntry.setDelaySeconds( IntegerStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("MessageAttribute", targetDepth)) { Entry<String, MessageAttributeValue> entry = MessageAttributesMapEntryUnmarshaller.getInstance().unmarshall(context); sendMessageBatchRequestEntry.getMessageAttributes().put(entry.getKey(), entry.getValue()); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return sendMessageBatchRequestEntry; } } } }