void (@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final PsiFile psiFile = startElement.getContainingFile(); final TextRange range = startElement.getTextRange(); final String xmlCharacter = getXmlCharacter(); String replacement = xmlCharacter.equals("&") ? AMP_ENTITY_REFERENCE : LT_ENTITY_REFERENCE; replacement = startElement.getText().replace(xmlCharacter, replacement); psiFile.getViewProvider().getDocument().replaceString( range.getStartOffset(), range.getEndOffset(), replacement ); }