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

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

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

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

        if (context.testExpression("DefaultValue", targetDepth)) {
          latLonOptions.setDefaultValue(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("SourceField", targetDepth)) {
          latLonOptions.setSourceField(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("FacetEnabled", targetDepth)) {
          latLonOptions.setFacetEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("SearchEnabled", targetDepth)) {
          latLonOptions.setSearchEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("ReturnEnabled", targetDepth)) {
          latLonOptions.setReturnEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("SortEnabled", targetDepth)) {
          latLonOptions.setSortEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return latLonOptions;
        }
      }
    }
  }
  public BuildSuggestersResult unmarshall(StaxUnmarshallerContext context) throws Exception {
    BuildSuggestersResult buildSuggestersResult = new BuildSuggestersResult();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("FieldNames/member", targetDepth)) {
          buildSuggestersResult.withFieldNames(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return buildSuggestersResult;
        }
      }
    }
  }
  public AnalysisOptions unmarshall(StaxUnmarshallerContext context) throws Exception {
    AnalysisOptions analysisOptions = new AnalysisOptions();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("Synonyms", targetDepth)) {
          analysisOptions.setSynonyms(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("Stopwords", targetDepth)) {
          analysisOptions.setStopwords(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("StemmingDictionary", targetDepth)) {
          analysisOptions.setStemmingDictionary(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("JapaneseTokenizationDictionary", targetDepth)) {
          analysisOptions.setJapaneseTokenizationDictionary(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("AlgorithmicStemming", targetDepth)) {
          analysisOptions.setAlgorithmicStemming(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return analysisOptions;
        }
      }
    }
  }
  public AnalysisScheme unmarshall(StaxUnmarshallerContext context) throws Exception {
    AnalysisScheme analysisScheme = new AnalysisScheme();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("AnalysisSchemeName", targetDepth)) {
          analysisScheme.setAnalysisSchemeName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("AnalysisSchemeLanguage", targetDepth)) {
          analysisScheme.setAnalysisSchemeLanguage(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("AnalysisOptions", targetDepth)) {
          analysisScheme.setAnalysisOptions(
              AnalysisOptionsStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return analysisScheme;
        }
      }
    }
  }