public EventDescription unmarshall(StaxUnmarshallerContext context) throws Exception { EventDescription eventDescription = new EventDescription(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return eventDescription; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("EventDate", targetDepth)) { eventDescription.setEventDate(DateStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Message", targetDepth)) { eventDescription.setMessage(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("ApplicationName", targetDepth)) { eventDescription.setApplicationName( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("VersionLabel", targetDepth)) { eventDescription.setVersionLabel( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("TemplateName", targetDepth)) { eventDescription.setTemplateName( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("EnvironmentName", targetDepth)) { eventDescription.setEnvironmentName( StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("RequestId", targetDepth)) { eventDescription.setRequestId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Severity", targetDepth)) { eventDescription.setSeverity(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return eventDescription; } } } }