void (@NotNull final PsiFile file, @NotNull final InspectionManager manager, @NotNull ProblemsHolder problemsHolder, @NotNull final GlobalInspectionContext globalContext, @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) { HighlightInfoHolder myHolder = new HighlightInfoHolder(file) { @Override public boolean add(@Nullable HighlightInfo info) { if (info != null) { GlobalInspectionUtil.createProblem( file, info, new TextRange(info.startOffset, info.endOffset), null, manager, problemDescriptionsProcessor, globalContext ); } return true; } }; final XmlHighlightVisitor highlightVisitor = new XmlHighlightVisitor(); highlightVisitor.analyze(file, true, myHolder, new Runnable() { @Override public void run() { file.accept(new XmlRecursiveElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { highlightVisitor.visit(element); super.visitElement(element); } }); } }); }