AntDomAntlib (PsiFile psiFile) { if (psiFile instanceof XmlFile) { final DomManager domManager = DomManager.getDomManager(psiFile.getProject()); final DomFileElement<AntDomAntlib> fileElement = domManager.getFileElement((XmlFile)psiFile, AntDomAntlib.class); return fileElement != null? fileElement.getRootElement() : null; } return null; }