PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { Pattern pattern = Pattern.compile(regexp); return new XmlElementVisitor() { @Override public void visitXmlTag(@NotNull XmlTag tag) { if (checkDeprecated(tag.getDescriptor(), pattern)) { ASTNode nameNode = XmlChildRole.START_TAG_NAME_FINDER.findChild(tag.getNode()); if (nameNode != null) { holder.registerProblem(nameNode.getPsi(), XmlAnalysisBundle.message("xml.inspections.the.tag.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } } @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { if (checkDeprecated(attribute.getDescriptor(), pattern)) { holder.registerProblem(attribute.getNameElement(), XmlAnalysisBundle.message( "xml.inspections.the.attribute.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } }; }