public ChangeInfo unmarshall(StaxUnmarshallerContext context) throws Exception { ChangeInfo changeInfo = new ChangeInfo(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return changeInfo; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Id", targetDepth)) { changeInfo.setId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Status", targetDepth)) { changeInfo.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("SubmittedAt", targetDepth)) { changeInfo.setSubmittedAt(DateStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Comment", targetDepth)) { changeInfo.setComment(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return changeInfo; } } } }