PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlToken(final @NotNull XmlToken token) { IElementType tokenType = token.getTokenType(); if (tokenType == XmlTokenType.XML_NAME || tokenType == XmlTokenType.XML_TAG_NAME) { PsiElement element = token.getPrevSibling(); while (element instanceof PsiWhiteSpace) element = element.getPrevSibling(); if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_START_TAG_START) { PsiElement parent = element.getParent(); if (parent instanceof XmlTag tag && !(token.getNextSibling() instanceof OuterLanguageElement)) { checkTag(tag, holder, isOnTheFly); } } } } @Override public void visitXmlText(@NotNull XmlText text) { checkText(text, holder, isOnTheFly); } @Override public void visitXmlAttribute(final @NotNull XmlAttribute attribute) { checkAttribute(attribute, holder, isOnTheFly); } @Override public void visitXmlAttributeValue(@NotNull XmlAttributeValue value) { checkAttributeValue(value, holder, isOnTheFly); } }; }