Object[] (XmlTag tag, ReferenceType type, String prefix) { String[] tagNames = switch (type) { case GroupReference -> new String[]{SchemaReferencesProvider.GROUP_TAG_NAME}; case AttributeGroupReference -> new String[]{SchemaReferencesProvider.ATTRIBUTE_GROUP_TAG_NAME}; case AttributeReference -> new String[]{SchemaReferencesProvider.ATTRIBUTE_TAG_NAME}; case ElementReference -> new String[]{SchemaReferencesProvider.ELEMENT_TAG_NAME}; case TypeReference -> new String[]{SchemaReferencesProvider.SIMPLE_TYPE_TAG_NAME, SchemaReferencesProvider.COMPLEX_TYPE_TAG_NAME}; }; final XmlDocument document = ((XmlFile)tag.getContainingFile()).getDocument(); if (document == null) { return ArrayUtilRt.EMPTY_OBJECT_ARRAY; } final XmlTag rootTag = document.getRootTag(); String ourNamespace = rootTag != null ? rootTag.getAttributeValue(TARGET_NAMESPACE) : ""; if (ourNamespace == null) ourNamespace = ""; CompletionProcessor processor = new CompletionProcessor(tag, prefix); for(String namespace: tag.knownNamespaces()) { if (ourNamespace.equals(namespace)) continue; final XmlNSDescriptor nsDescriptor = tag.getNSDescriptor(namespace, true); if (nsDescriptor instanceof XsdNsDescriptor) { processNamespace(namespace, processor, (XsdNsDescriptor)nsDescriptor, tagNames); } } XmlNSDescriptor nsDescriptor = (XmlNSDescriptor)document.getMetaData(); if (nsDescriptor instanceof XmlNSDescriptorImpl) { processNamespace( ourNamespace, processor, (XmlNSDescriptorImpl)nsDescriptor, tagNames ); } return ArrayUtilRt.toStringArray(processor.myElements); }