void (@NotNull final XmlTag tag, @NotNull final ProblemsHolder holder, final boolean isOnTheFly) { if (!(tag.getParent() instanceof XmlTag)) { final PsiFile psiFile = tag.getContainingFile(); if (!(psiFile instanceof XmlFile xmlFile)) { return; } final XmlDocument document = xmlFile.getDocument(); if (document == null) { return; } XmlProlog prolog = document.getProlog(); if (prolog == null || XmlHighlightVisitor.skipValidation(prolog)) { return; } final XmlDoctype doctype = prolog.getDoctype(); if (doctype == null) { return; } XmlElement nameElement = doctype.getNameElement(); if (nameElement == null) { return; } String name = tag.getName(); String text = nameElement.getText(); if (tag instanceof HtmlTag) { name = StringUtil.toLowerCase(name); text = StringUtil.toLowerCase(text); } if (!name.equals(text)) { name = XmlUtil.findLocalNameByQualifiedName(name); if (!name.equals(text)) { if (tag instanceof HtmlTag) { return; // it is legal to have html / head / body omitted } final LocalQuickFix localQuickFix = new MyLocalQuickFix(doctype.getNameElement().getText()); holder.registerProblem(XmlChildRole.START_TAG_NAME_FINDER.findChild(tag.getNode()).getPsi(), XmlAnalysisBundle.message("xml.inspections.wrong.root.element"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, localQuickFix ); final ASTNode astNode = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(tag.getNode()); if (astNode != null) { holder.registerProblem(astNode.getPsi(), XmlAnalysisBundle.message("xml.inspections.wrong.root.element"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, localQuickFix ); } } } } }