public ResourceSpecificResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    ResourceSpecificResult resourceSpecificResult = new ResourceSpecificResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 2;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return resourceSpecificResult;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("EvalResourceName", targetDepth)) {
          resourceSpecificResult.setEvalResourceName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("EvalResourceDecision", targetDepth)) {
          resourceSpecificResult.setEvalResourceDecision(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("MatchedStatements/member", targetDepth)) {
          resourceSpecificResult
              .getMatchedStatements()
              .add(StatementStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("MissingContextValues/member", targetDepth)) {
          resourceSpecificResult
              .getMissingContextValues()
              .add(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("EvalDecisionDetails/entry", targetDepth)) {
          Entry<String, String> entry =
              EvalDecisionDetailsMapEntryUnmarshaller.getInstance().unmarshall(context);
          resourceSpecificResult.getEvalDecisionDetails().put(entry.getKey(), entry.getValue());
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return resourceSpecificResult;
        }
      }
    }
  }
  public EvaluationResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    EvaluationResult evaluationResult = new EvaluationResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 1;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return evaluationResult;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

        if (context.testExpression("EvalActionName", targetDepth)) {
          evaluationResult.setEvalActionName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("EvalResourceName", targetDepth)) {
          evaluationResult.setEvalResourceName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("EvalDecision", targetDepth)) {
          evaluationResult.setEvalDecision(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("MatchedStatements", targetDepth)) {
          evaluationResult.withMatchedStatements(new ArrayList<Statement>());
          continue;
        }

        if (context.testExpression("MatchedStatements/member", targetDepth)) {
          evaluationResult.withMatchedStatements(
              StatementStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("MissingContextValues", targetDepth)) {
          evaluationResult.withMissingContextValues(new ArrayList<String>());
          continue;
        }

        if (context.testExpression("MissingContextValues/member", targetDepth)) {
          evaluationResult.withMissingContextValues(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("EvalDecisionDetails/entry", targetDepth)) {
          Entry<String, String> entry =
              EvalDecisionDetailsMapEntryUnmarshaller.getInstance().unmarshall(context);
          evaluationResult.addEvalDecisionDetailsEntry(entry.getKey(), entry.getValue());
          continue;
        }

        if (context.testExpression("ResourceSpecificResults", targetDepth)) {
          evaluationResult.withResourceSpecificResults(new ArrayList<ResourceSpecificResult>());
          continue;
        }

        if (context.testExpression("ResourceSpecificResults/member", targetDepth)) {
          evaluationResult.withResourceSpecificResults(
              ResourceSpecificResultStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return evaluationResult;
        }
      }
    }
  }