void (@NotNull Project project, @Nullable String templateText, @NotNull PairProcessor<? super XmlTag, ? super Boolean> processor) { if (StringUtil.isNotEmpty(templateText)) { final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project); XmlFile xmlFile = (XmlFile)psiFileFactory.createFileFromText("dummy.xml", HtmlFileType.INSTANCE, templateText); XmlTag tag = xmlFile.getRootTag(); boolean firstTag = true; while (tag != null) { processor.process(tag, firstTag); firstTag = false; tag = PsiTreeUtil.getNextSiblingOfType(tag, XmlTag.class); } } }