Result<ElementNames> () { final ElementNames names = new ElementNames(); final PsiFile[] associations = myFileAssociationsManager.getAssociationsFor(file, FileAssociationsManager.Holder.XML_FILES); if (associations.length == 0) { fillFromSchema(file, names); } else { names.validateNames = true; //noinspection unchecked ContainerUtil.addAll(names.dependencies, associations); } //noinspection unchecked names.dependencies.add(myFileAssociationsManager); for (PsiFile file : associations) { if (!(file instanceof XmlFile)) continue; file.accept(new XmlRecursiveElementVisitor() { @Override public void visitXmlTag(@NotNull XmlTag tag) { names.elementNames.add(QNameUtil.createQName(tag)); super.visitXmlTag(tag); } @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { if (!attribute.isNamespaceDeclaration()) { names.attributeNames.add(QNameUtil.createQName(attribute)); } super.visitXmlAttribute(attribute); } }); } return new Result<>(names, ArrayUtil.toObjectArray(names.dependencies)); }