private static void processScenario(
      String aliasName, XMLStreamReader2 streamReader, AliasDefinitionsData data) {
    String scenarioName = streamReader.getAttributeValue(null, "name");
    String aliasClass = streamReader.getAttributeValue(null, "class");
    AliasOverride scenarioAlias = new AliasOverride(aliasName, aliasClass);

    data.getScenarioAliases(aliasName).put(scenarioName, scenarioAlias);
  }
  private static void processGroupAlias(
      String groupName, XMLStreamReader2 streamReader, AliasDefinitionsData data) {
    String aliasName = streamReader.getAttributeValue(null, "name");
    String aliasClass = streamReader.getAttributeValue(null, "class");
    AliasOverride groupAlias = new AliasOverride(aliasName, aliasClass);

    data.getGroupAliases(groupName).add(groupAlias);
  }
  public static AliasDefinitionsData read(
      MemoizedFile aliasDefinitionsFile,
      AssetLocation assetLocation,
      String defaultFileCharacterEncoding)
      throws ContentFileProcessingException {
    AliasDefinitionsData data = new AliasDefinitionsData();
    data.aliasDefinitions = new ArrayList<>();
    data.scenarioAliases = new HashMap<>();
    data.groupAliases = new HashMap<>();

    if (aliasDefinitionsFile.exists()) {
      try (Reader fileReader =
          new UnicodeReader(aliasDefinitionsFile, defaultFileCharacterEncoding)) {
        XMLStreamReader2 streamReader =
            XmlStreamReaderFactory.createReader(fileReader, aliasDefinitionsSchema);
        XmlStreamCursor cursor = new XmlStreamCursor(streamReader);

        while (cursor.isWithinInitialNode()) {
          if (streamReader.getEventType() == XMLStreamReader.START_ELEMENT) {
            switch (streamReader.getLocalName()) {
              case "alias":
                processAlias(streamReader, data, aliasDefinitionsFile, assetLocation);
                break;

              case "group":
                processGroup(streamReader, data, assetLocation);
                break;
            }
          }

          cursor.nextTag();
        }
      } catch (XMLStreamException e) {
        Location location = e.getLocation();

        throw new ContentFileProcessingException(
            aliasDefinitionsFile, location.getLineNumber(), location.getColumnNumber(), e);
      } catch (IOException | NamespaceException | RequirePathException | AliasException e) {
        throw new ContentFileProcessingException(aliasDefinitionsFile, e);
      }
    }

    return data;
  }