boolean (@NotNull PsiElement contextElement, int offset) { ASTNode node = contextElement.getNode(); if (node != null && node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS) { PsiElement parent = contextElement.getParent(); if (parent instanceof XmlText || parent instanceof XmlDocument) { String contextElementText = contextElement.getText(); int endOffset = offset - contextElement.getTextRange().getStartOffset(); String prefix = contextElementText.substring(0, Math.min(contextElementText.length(), endOffset)); return !StringUtil.startsWithChar(prefix, '<') && !StringUtil.startsWithChar(prefix, '&'); } } return false; }