code: public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) {
          DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
  
          boolean suppressLoad = false;
          ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy();
          final boolean isReloaded = environment.getRunningModeControl().isReloaded();
  
          if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) {
              throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName());
          }
  
          if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) {
              suppressLoad = true;
          }
  
          BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad);
          for (Namespace namespace : Namespace.domainValues()) {
              if (!namespace.equals(Namespace.CURRENT)) {
                  persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml);
              }
          }
          extensionRegistry.setWriterRegistry(persister);
          return persister;
      }
docs: domain.xml