boolean (Object element, PsiElement context) { final PsiElement parent = context.getParent(); if((parent instanceof XmlEntityDecl && !((XmlEntityDecl)parent).isInternalReference() ) ) { PsiElement prevSibling = context.getPrevSibling(); if (prevSibling instanceof PsiWhiteSpace) { prevSibling = prevSibling.getPrevSibling(); } if (prevSibling instanceof XmlToken && ((XmlToken)prevSibling).getTokenType() == XmlTokenType.XML_DOCTYPE_SYSTEM || prevSibling instanceof XmlAttributeValue ) { return true; } } return false; }