boolean (Object element, PsiElement context) { if(element instanceof XmlTag psiElement){ if (!psiElement.isValid()) return false; final String ns = psiElement.getNamespace(); if (isNamespaceAcceptable(ns)) return true; final PsiFile psiFile = psiElement.getContainingFile(); if (psiFile instanceof XmlFile) { // We use file references for as dtd namespace // But we should also check PUBLIC ID for namespace XmlDocument document = ((XmlFile)psiFile).getDocument(); if (document == null) return false; final XmlProlog prolog = document.getProlog(); if (prolog != null) { final XmlDoctype doctype = prolog.getDoctype(); if (doctype != null) { final String publicId = doctype.getPublicId(); if (publicId != null) { if (isNamespaceAcceptable(publicId)) return true; } } } } } else if(element instanceof XmlDocument){ return isAcceptable(((XmlDocument) element).getRootTag(), context); } return false; }