PsiLanguageInjectionHost (final @NotNull String text) { final PsiFile psiFile = getContainingFile(); final XmlDocument document = ((XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy", psiFile.getFileType(), text)).getDocument(); assert document != null; final XmlComment comment = PsiTreeUtil.getChildOfType(document, XmlComment.class); assert comment != null; replaceAllChildrenToChildrenOf(comment.getNode()); return this; }