XmlElementDescriptor[] (XmlTag context) { if (context != null) { final XmlElementDescriptor parentDescriptorByType = XmlUtil.findXmlDescriptorByType(context); if (parentDescriptorByType != null && !parentDescriptorByType.equals(this)) { return parentDescriptorByType.getElementsDescriptors(context); } } XmlElementDescriptor[] elementsDescriptors = getElementsDescriptorsImpl(context); final TypeDescriptor type = getType(context); if (type instanceof ComplexTypeDescriptor descriptor) { PsiFile containingFile = context != null ? context.getContainingFile():null; if (context != null && !containingFile.isPhysical()) { containingFile = containingFile.getOriginalFile(); //context = context.getParentTag(); } String contextNs; if (context != null && descriptor.canContainTag(context.getLocalName(), contextNs = context.getNamespace(), context) && (!contextNs.equals(getNamespace()) || descriptor.hasAnyInContentModel()) && containingFile instanceof XmlFile) { // JSXmlLiteralExpressionImpl, being an xml element itself, may be contained in non-XML file final XmlNSDescriptor nsDescriptor = getNSDescriptor(); if (nsDescriptor != null) { elementsDescriptors = ArrayUtil.mergeArrays( elementsDescriptors, nsDescriptor.getRootElementsDescriptors(((XmlFile)containingFile).getDocument()) ); } } } return elementsDescriptors; }