XmlFile (XmlFile file) { final RngElementDescriptor descriptor = getRootDescriptor(file); if (descriptor == null) return null; final PsiElement element = descriptor.getDeclaration(); final XmlFile schema = PsiTreeUtil.getParentOfType(element, XmlFile.class); if (schema == null) return null; return schema; }