private static void loadEntities(@NotNull Project project) {
      if (ourEntities != null) return;

      XmlFile file;
      try {
        String url = ExternalResourceManager.getInstance().getResourceLocation(XmlUtil.HTML4_LOOSE_URI, project);
        if (url == null) {
          Logger.getInstance(ConvertToBasicLatinInspection.class).error("Namespace not found: " + XmlUtil.HTML4_LOOSE_URI);
          return;
        }
        VirtualFile vFile = VfsUtil.findFileByURL(new URL(url));
        if (vFile == null) {
          Logger.getInstance(ConvertToBasicLatinInspection.class).error("Resource not found: " + url);
          return;
        }
        PsiFile psiFile = PsiManager.getInstance(project).findFile(vFile);
        if (!(psiFile instanceof XmlFile)) {
          Logger.getInstance(ConvertToBasicLatinInspection.class).error("Unexpected resource: " + psiFile);
          return;
        }
        file = (XmlFile)psiFile;
      }
      catch (MalformedURLException e) {
        Logger.getInstance(ConvertToBasicLatinInspection.class).error(e);
        return;
      }

      Int2ObjectMap<String> entities = new Int2ObjectOpenHashMap<>();
      Pattern pattern = Pattern.compile("&#(\\d+);");
      XmlUtil.processXmlElements(file, element -> {
        if (element instanceof XmlEntityDecl entity) {
          Matcher m = pattern.matcher(entity.getValueElement().getValue());
          if (m.matches()) {
            char i = (char)Integer.parseInt(m.group(1));
            if (!isBasicLatin(i)) {
              entities.put(i, entity.getName());
            }
          }
        }
        return true;
      }, true);

      ourEntities = entities;
    }
private static void loadEntities(@NotNull Project project)