Grammar (@NotNull XmlFile element) { if (element instanceof RncFile) { return ((RncFile)element).getGrammar(); } final DomFileElement<RngGrammar> fileElement = DomManager.getDomManager(element.getProject()).getFileElement(element, RngGrammar.class); return fileElement != null ? fileElement.getRootElement() : null; }