Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
299,800
XmlTag () { return myTag; }
getTag
299,801
boolean () { return myFile != null && getDeclaration().isValid(); }
isValid
299,802
TypeDescriptor (XmlElement context) { TypeDescriptor typeDescriptor = super.getType(context); return typeDescriptor instanceof ComplexTypeDescriptor ? new RedefinedTypeDescriptor((ComplexTypeDescriptor)typeDescriptor, myRedefined, myOriginalNsDescriptor) : typeDescriptor; }
getType
299,803
void (XmlSchemaTagsProcessor processor, Map<String, XmlElementDescriptor> map) { String typeName = getTypeName(); if (typeName != null) { TypeDescriptor descriptor = myOriginalNsDescriptor.getTypeDescriptor(typeName, myOriginalNsDescriptor.getTag()); if (descriptor instanceof ComplexTypeDescriptor) { ((ComplexTypeDescriptor)descriptor).processElements(super.createProcessor(map, myOriginalNsDescriptor), map); } } super.processElements(createProcessor(map, myDocumentDescriptor), map); }
processElements
299,804
XmlSchemaTagsProcessor (final Map<String, XmlElementDescriptor> map, final XmlNSDescriptorImpl nsDescriptor) { return new XmlSchemaTagsProcessor(nsDescriptor) { @Override protected void tagStarted(XmlTag tag, String tagName, XmlTag context, XmlTag ref) { addElementDescriptor(tag, tagName, map, null, myDocumentDescriptor); if ("extension".equals(tagName)) { String base = tag.getAttributeValue("base"); if (base != null) { TypeDescriptor descriptor = myRedefinedNSDescriptor.findTypeDescriptor(base); if (descriptor instanceof ComplexTypeDescriptor) { XmlElementDescriptor[] elements = ((ComplexTypeDescriptor)descriptor).getElements(null); for (XmlElementDescriptor element : elements) { addElementDescriptor(map, element, null); } } } } } }; }
createProcessor
299,805
void (XmlTag tag, String tagName, XmlTag context, XmlTag ref) { addElementDescriptor(tag, tagName, map, null, myDocumentDescriptor); if ("extension".equals(tagName)) { String base = tag.getAttributeValue("base"); if (base != null) { TypeDescriptor descriptor = myRedefinedNSDescriptor.findTypeDescriptor(base); if (descriptor instanceof ComplexTypeDescriptor) { XmlElementDescriptor[] elements = ((ComplexTypeDescriptor)descriptor).getElements(null); for (XmlElementDescriptor element : elements) { addElementDescriptor(map, element, null); } } } } }
tagStarted
299,806
String () { if (isFixed()) { return getDeclaration().getAttributeValue("fixed"); } return getDeclaration().getAttributeValue("default"); }
getDefaultValue
299,807
boolean () { return getDeclaration().getAttributeValue("fixed") != null; }
isFixed
299,808
String[] () { return getEnumeratedValues(false); }
getEnumeratedValues
299,809
String[] () { return getEnumeratedValues(true); }
getValuesForCompletion
299,810
String[] (boolean forCompletion) { final List<String> list = new SmartList<>(); processEnumeration(null, (element, s) -> { list.add(s); return true; }, forCompletion); String defaultValue = getDefaultValue(); if (defaultValue != null) { list.add(defaultValue); } return ArrayUtilRt.toStringArray(list); }
getEnumeratedValues
299,811
boolean (XmlElement context, PairProcessor<? super PsiElement, ? super String> processor, boolean forCompletion) { if (getDeclaration() == null) return false; XmlTag contextTag = context != null ? PsiTreeUtil.getContextOfType(context, XmlTag.class, false) : null; final XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)XmlUtil.findXmlDescriptorByType(getDeclaration(), contextTag); if (elementDescriptor!=null && elementDescriptor.getType() instanceof ComplexTypeDescriptor) { TypeDescriptor type = elementDescriptor.getType(); return processEnumerationImpl(type.getDeclaration(), (ComplexTypeDescriptor)type, processor, forCompletion); } final String namespacePrefix = getDeclaration().getNamespacePrefix(); XmlTag type = getDeclaration().findFirstSubTag( ((namespacePrefix.length() > 0) ? namespacePrefix + ":" : "") + "simpleType" ); if (type != null) { return processEnumerationImpl(type, null, processor, forCompletion); } return false; }
processEnumeration
299,812
boolean (final XmlTag declaration, @Nullable ComplexTypeDescriptor type, final PairProcessor<? super PsiElement, ? super String> pairProcessor, boolean forCompletion) { XmlAttribute name = declaration.getAttribute("name"); if (name != null && "boolean".equals(name.getValue()) && type != null) { XmlNSDescriptorImpl nsDescriptor = type.getNsDescriptor(); if (nsDescriptor != null) { String namespace = nsDescriptor.getDefaultNamespace(); if (XmlUtil.XML_SCHEMA_URI.equals(namespace)) { XmlAttributeValue valueElement = name.getValueElement(); pairProcessor.process(valueElement, "true"); pairProcessor.process(valueElement, "false"); if (!forCompletion) { pairProcessor.process(valueElement, "1"); pairProcessor.process(valueElement, "0"); } myExhaustiveEnum = true; return true; } } } final Ref<Boolean> found = new Ref<>(Boolean.FALSE); myExhaustiveEnum = XmlUtil.processEnumerationValues(declaration, tag -> { found.set(Boolean.TRUE); XmlAttribute name1 = tag.getAttribute("value"); return name1 == null || pairProcessor.process(tag, name1.getValue()); }); return found.get(); }
processEnumerationImpl
299,813
PsiElement (XmlElement attributeValue, String value) { PsiElement declaration = super.getValueDeclaration(attributeValue, value); if (declaration == null && !myExhaustiveEnum) { return getDeclaration(); } return declaration; }
getValueDeclaration
299,814
boolean (@Nullable XmlElement context) { return processEnumeration(context, PairProcessor.alwaysTrue(), false); }
isEnumerated
299,815
PsiElement (XmlElement xmlElement, final String value) { final Ref<PsiElement> result = new Ref<>(); processEnumeration(getDeclaration(), (element, s) -> { if (value.equals(s)) { result.set(element); return false; } return true; }, false); return result.get(); }
getEnumeratedValueDeclaration
299,816
PsiElement () { return getDeclaration(); }
getDefaultValueDeclaration
299,817
boolean () { XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)XmlUtil.findXmlDescriptorByType(getDeclaration(), null); if (elementDescriptor == null) return false; TypeDescriptor type = elementDescriptor.getType(null); if (!(type instanceof ComplexTypeDescriptor)) return false; final Ref<Boolean> result = new Ref<>(false); new XmlSchemaTagsProcessor(((ComplexTypeDescriptor)type).getNsDescriptor()) { @Override protected void tagStarted(XmlTag tag, String tagName, XmlTag context, @Nullable XmlTag ref) { if ("list".equals(tagName) || "union".equals(tagName)) { result.set(true); } } }.startProcessing(type.getDeclaration()); return result.get(); }
isList
299,818
void (XmlTag tag, String tagName, XmlTag context, @Nullable XmlTag ref) { if ("list".equals(tagName) || "union".equals(tagName)) { result.set(true); } }
tagStarted
299,819
PsiElement () { return myDcl; }
getDeclaration
299,820
String (PsiElement context) { return getName(); }
getName
299,821
String () { return myDcl.getAttributeValue("name"); }
getName
299,822
void (PsiElement element) { myDcl = (XmlTag)element; }
init
299,823
void (XmlTag tag) { try { PROCESSING_FLAG.set(Boolean.TRUE); processTag(tag, null); } finally { PROCESSING_FLAG.set(null); } }
startProcessing
299,824
void (XmlTag tag, @Nullable XmlTag context) { if (myVisited.contains(tag)) return; myVisited.add(tag); if (!XmlNSDescriptorImpl.checkSchemaNamespace(tag)) { processTagWithSubTags(tag, context, null); return; } String tagName = tag.getLocalName(); if (checkTagName(tagName, "element", "attribute")) { XmlAttribute ref = tag.getAttribute("ref"); if (ref != null) { XmlTag resolved = resolveTagReference(ref); if (resolved != null) { tagStarted(resolved, resolved.getLocalName(), tag, tag); } } else { tagStarted(tag, tag.getLocalName(), context, null); } } else if (checkTagName(tagName, "group")) { String value = tag.getAttributeValue("ref"); if (value != null) { XmlTag group = myNsDescriptor.findGroup(value); if (group == null) group = resolveTagReference(tag.getAttribute("ref")); processTagWithSubTags(group, tag, tag); } } else if (checkTagName(tagName, "attributeGroup")) { String ref = tag.getAttributeValue("ref"); if (ref == null) return; XmlTag group; XmlTag parentTag = tag.getParentTag(); assert parentTag != null; if (XmlNSDescriptorImpl.equalsToSchemaName(parentTag, "attributeGroup") && ref.equals(parentTag.getAttributeValue("name"))) { group = resolveTagReference(tag.getAttribute("ref")); if (group == null) group = myNsDescriptor.findAttributeGroup(ref); } else { group = myNsDescriptor.findAttributeGroup(ref); if (group == null) group = resolveTagReference(tag.getAttribute("ref")); } processTagWithSubTags(group, tag, null); } else if (checkTagName(tagName, "restriction", "extension")) { processTagWithSubTags(resolveTagReference(tag.getAttribute("base")), tag, null); processTagWithSubTags(tag, context, null); } else if (!checkTagName(tagName, myTagsToIgnore)) { processTagWithSubTags(tag, context, null); } }
processTag
299,825
void (@Nullable XmlTag tag, XmlTag ctx, @Nullable XmlTag ref) { if (tag == null) return; tagStarted(tag, tag.getLocalName(), ctx, ref); XmlTag[] subTags = tag.getSubTags(); for (XmlTag subTag : subTags) { processTag(subTag, tag); } tagFinished(tag); }
processTagWithSubTags
299,826
void (XmlTag tag) {}
tagFinished
299,827
boolean (String tagName, String... names) { return ArrayUtil.contains(tagName, names); }
checkTagName
299,828
PsiElement () { return null; }
getDeclaration
299,829
String (PsiElement context) { return myAttributeName; }
getName
299,830
String () { return myAttributeName; }
getName
299,831
void (PsiElement element) { }
init
299,832
String () { return myAttributeName; }
getQualifiedName
299,833
String () { return myAttributeName; }
getDefaultName
299,834
boolean () { return false; }
isRequired
299,835
boolean () { return false; }
isFixed
299,836
boolean () { return false; }
hasIdType
299,837
boolean () { return false; }
hasIdRefType
299,838
String () { return null; }
getDefaultValue
299,839
boolean () { return false; }
isEnumerated
299,840
String[] () { return ArrayUtilRt.EMPTY_STRING_ARRAY; }
getEnumeratedValues
299,841
String (XmlElement context, String value) { return null; }
validateValue
299,842
XmlElementDescriptor[] (final ComplexTypeDescriptor complexTypeDescriptor, final XmlElement context) { return complexTypeDescriptor.doCollectElements(context); }
compute
299,843
XmlElementDescriptor[] (final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { return complexTypeDescriptor.myElementDescriptors; }
getValue
299,844
void (final XmlElementDescriptor[] xmlElementDescriptors, final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { complexTypeDescriptor.myElementDescriptors = xmlElementDescriptors; }
putValue
299,845
XmlAttributeDescriptor[] (final ComplexTypeDescriptor complexTypeDescriptor, XmlElement p) { return complexTypeDescriptor.doCollectAttributes(); }
compute
299,846
XmlAttributeDescriptor[] (final ComplexTypeDescriptor complexTypeDescriptor, Object o) { return complexTypeDescriptor.myAttributeDescriptors; }
getValue
299,847
void (final XmlAttributeDescriptor[] xmlAttributeDescriptors, final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { complexTypeDescriptor.myAttributeDescriptors = xmlAttributeDescriptors; }
putValue
299,848
XmlTag () { return super.getDeclaration(); }
getDeclaration
299,849
XmlElementDescriptor[] (XmlElement context) { return myElementDescriptorsCache.get(null, this, context); }
getElements
299,850
XmlElementDescriptor[] (XmlElement context) { final Map<String,XmlElementDescriptor> map = new LinkedHashMap<>(5); XmlNSDescriptor descriptor = null; if (context instanceof XmlTag) { descriptor = ((XmlTag)context).getNSDescriptor(myDocumentDescriptor.getDefaultNamespace(), true); } processElements(createProcessor(map, descriptor instanceof XmlNSDescriptorImpl ? (XmlNSDescriptorImpl)descriptor : myDocumentDescriptor), map); return map.values().toArray(XmlElementDescriptor.EMPTY_ARRAY); }
doCollectElements
299,851
void (XmlSchemaTagsProcessor processor, Map<String, XmlElementDescriptor> map) { processor.startProcessing(myTag); addSubstitutionGroups(map, myDocumentDescriptor, new HashSet<>()); filterAbstractElements(map); }
processElements
299,852
XmlSchemaTagsProcessor (final Map<String, XmlElementDescriptor> map, final XmlNSDescriptorImpl nsDescriptor) { return new XmlSchemaTagsProcessor(nsDescriptor) { @Override protected void tagStarted(XmlTag tag, String tagName, XmlTag context, @Nullable XmlTag ref) { String refName = ref == null ? null : ref.getAttributeValue(REF_ATTR_NAME); addElementDescriptor(tag, tagName, map, refName, myDocumentDescriptor); } }; }
createProcessor
299,853
void (XmlTag tag, String tagName, XmlTag context, @Nullable XmlTag ref) { String refName = ref == null ? null : ref.getAttributeValue(REF_ATTR_NAME); addElementDescriptor(tag, tagName, map, refName, myDocumentDescriptor); }
tagStarted
299,854
void (XmlTag tag, String tagName, Map<String, XmlElementDescriptor> map, @Nullable String refName, XmlNSDescriptorImpl nsDescriptor) { if ("element".equals(tagName) && tag.getAttribute("name") != null) { XmlElementDescriptor element = nsDescriptor.createElementDescriptor(tag); String name = refName == null ? element.getName() : refName; addElementDescriptor(map, element, name); } }
addElementDescriptor
299,855
void (Map<String, XmlElementDescriptor> result, XmlNSDescriptorImpl nsDescriptor, Set<? super XmlNSDescriptorImpl> visited) { mainLoop: while (true) { for (final XmlElementDescriptor xmlElementDescriptor : result.values()) { XmlElementDescriptorImpl descriptor = (XmlElementDescriptorImpl)xmlElementDescriptor; final XmlElementDescriptor[] substitutes = nsDescriptor.getSubstitutes(descriptor.getName(), descriptor.getNamespace()); boolean toContinue = false; for (XmlElementDescriptor substitute : substitutes) { if (result.get(substitute.getName()) == null) { toContinue = true; result.put(substitute.getName(), substitute); } } if (toContinue) continue mainLoop; } break; } visited.add(nsDescriptor); for (XmlTag tag : nsDescriptor.getTag().getSubTags()) { if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "include") || XmlNSDescriptorImpl.equalsToSchemaName(tag, "import")) { XmlAttribute location = tag.getAttribute("schemaLocation"); if (location != null) { XmlAttributeValue valueElement = location.getValueElement(); if (valueElement != null) { PsiElement element = new FileReferenceSet(valueElement).resolve(); if (element instanceof XmlFile) { XmlDocument document = ((XmlFile)element).getDocument(); if (document != null) { PsiMetaData metaData = document.getMetaData(); if (metaData instanceof XmlNSDescriptorImpl && !visited.contains(metaData)) { addSubstitutionGroups(result, (XmlNSDescriptorImpl)metaData, visited); } } } } } } } }
addSubstitutionGroups
299,856
void (Map<String,XmlElementDescriptor> result) { for (Iterator<XmlElementDescriptor> iterator = result.values().iterator(); iterator.hasNext();) { XmlElementDescriptorImpl descriptor = (XmlElementDescriptorImpl)iterator.next(); if (descriptor.isAbstract()) iterator.remove(); } }
filterAbstractElements
299,857
XmlAttributeDescriptor[] (@Nullable XmlElement context) { return myAttributeDescriptorsCache.get(null, this, context); }
getAttributes
299,858
XmlAttributeDescriptor[] () { final List<XmlAttributeDescriptorImpl> result = new ArrayList<>(); XmlSchemaTagsProcessor processor = new XmlSchemaTagsProcessor(myDocumentDescriptor, "element") { @Override protected void tagStarted(XmlTag tag, String tagName, XmlTag context, XmlTag ref) { if (ATTRIBUTE_TAG_NAME.equals(tagName)) { String name = tag.getAttributeValue(NAME_ATTR_NAME); if (name == null) return; String use = null; if (ATTRIBUTE_TAG_NAME.equals(context.getLocalName())) { // from ref use = context.getAttributeValue("use"); } if (use == null) use = tag.getAttributeValue("use"); if (PROHIBITED_ATTR_VALUE.equals(use)) { removeAttributeDescriptor(result, name, null); } else { XmlAttributeDescriptorImpl descriptor = new XmlAttributeDescriptorImpl(tag); descriptor.myUse = use; if (ref != null) { descriptor.myReferenceName = ref.getAttributeValue(REF_ATTR_NAME); } addAttributeDescriptor(result, descriptor); } } } }; processor.startProcessing(myTag); return result.toArray(XmlAttributeDescriptor.EMPTY); }
doCollectAttributes
299,859
void (XmlTag tag, String tagName, XmlTag context, XmlTag ref) { if (ATTRIBUTE_TAG_NAME.equals(tagName)) { String name = tag.getAttributeValue(NAME_ATTR_NAME); if (name == null) return; String use = null; if (ATTRIBUTE_TAG_NAME.equals(context.getLocalName())) { // from ref use = context.getAttributeValue("use"); } if (use == null) use = tag.getAttributeValue("use"); if (PROHIBITED_ATTR_VALUE.equals(use)) { removeAttributeDescriptor(result, name, null); } else { XmlAttributeDescriptorImpl descriptor = new XmlAttributeDescriptorImpl(tag); descriptor.myUse = use; if (ref != null) { descriptor.myReferenceName = ref.getAttributeValue(REF_ATTR_NAME); } addAttributeDescriptor(result, descriptor); } } }
tagStarted
299,860
XmlNSDescriptorImpl () { return myDocumentDescriptor; }
getNsDescriptor
299,861
void (Map<String, XmlElementDescriptor> result, XmlElementDescriptor element, String name) { result.remove(name); result.put(name, element); }
addElementDescriptor
299,862
void (List<XmlAttributeDescriptorImpl> result, String name, String referenceName) { for (Iterator<XmlAttributeDescriptorImpl> iterator = result.iterator(); iterator.hasNext();) { XmlAttributeDescriptorImpl descriptor = iterator.next(); if (descriptor.getName().equals(name) && (referenceName == null || referenceName.equals(descriptor.myReferenceName))) { iterator.remove(); } } }
removeAttributeDescriptor
299,863
void (List<XmlAttributeDescriptorImpl> result, XmlAttributeDescriptorImpl descriptor) { removeAttributeDescriptor(result, descriptor.getName(), descriptor.myReferenceName); result.add(descriptor); }
addAttributeDescriptor
299,864
boolean (String localName, String namespace, XmlElement context) { return _canContainTag(localName, namespace, myTag, context, new HashSet<>(5), new CurrentContextInfo(myDocumentDescriptor, myDocumentDescriptor.getDefaultNamespace()), false); }
canContainTag
299,865
CurrentContextInfo (CurrentContextInfo info, String ref) { XmlTag rootTag = info.documentDescriptor.getTag(); XmlNSDescriptorImpl nsDescriptor = XmlNSDescriptorImpl.getNSDescriptorToSearchIn(rootTag, ref, info.documentDescriptor); String ns; if (nsDescriptor == info.documentDescriptor) { ns = rootTag.getNamespaceByPrefix(XmlUtil.findPrefixByQualifiedName(ref)); } else { ns = nsDescriptor.getDefaultNamespace(); } if (Objects.equals(info.expectedDefaultNs, ns) && info.documentDescriptor == nsDescriptor) return info; return new CurrentContextInfo(nsDescriptor, ns); }
getContextInfo
299,866
boolean (String localName, String namespace, XmlTag tag, XmlElement context, Set<XmlTag> visited, CurrentContextInfo info, boolean restriction) { if (visited.contains(tag)) return false; visited.add(tag); if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "any")) { if (!restriction) { myHasAnyInContentModel = true; } if (OTHER_NAMESPACE_ATTR_VALUE.equals(tag.getAttributeValue("namespace"))) { return namespace == null || !namespace.equals(info.expectedDefaultNs); } return true; } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "group")) { String ref = tag.getAttributeValue(REF_ATTR_NAME); if (ref != null) { XmlTag groupTag = info.documentDescriptor.findGroup(ref); if (groupTag != null) { if (_canContainTag(localName, namespace, groupTag, context, visited, getContextInfo(info, ref), restriction)) return true; } } } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, RESTRICTION_TAG_NAME) || XmlNSDescriptorImpl.equalsToSchemaName(tag, EXTENSION_TAG_NAME)) { String base = tag.getAttributeValue(BASE_ATTR_NAME); if (base != null) { TypeDescriptor descriptor = info.documentDescriptor.findTypeDescriptor(base); if (descriptor instanceof ComplexTypeDescriptor complexTypeDescriptor) { if (complexTypeDescriptor._canContainTag(localName, namespace, complexTypeDescriptor.myTag, context, visited, getContextInfo(info, base), restriction || XmlNSDescriptorImpl.equalsToSchemaName(tag, RESTRICTION_TAG_NAME))) { myHasAnyInContentModel |= complexTypeDescriptor.myHasAnyInContentModel; return true; } } } } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, ELEMENT_TAG_NAME)) { final XmlAttribute ref = tag.getAttribute(REF_ATTR_NAME); XmlTag descriptorTag = tag; if (ref != null) { XmlAttributeValue element = ref.getValueElement(); final PsiElement psiElement; if (element != null) { psiElement = SchemaReferencesProvider.createTypeOrElementOrAttributeReference(element).resolve(); if (psiElement instanceof XmlTag) descriptorTag = (XmlTag)psiElement; } } if (TRUE_ATTR_VALUE.equals(descriptorTag.getAttributeValue("abstract"))) { XmlNSDescriptor _nsDescriptor = tag.getNSDescriptor(namespace, true); if (_nsDescriptor == null && context instanceof XmlTag) { _nsDescriptor = ((XmlTag)context).getNSDescriptor(namespace, true); } final XmlNSDescriptorImpl nsDescriptor = _nsDescriptor instanceof XmlNSDescriptorImpl ? (XmlNSDescriptorImpl)_nsDescriptor:null; final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(localName, namespace):null; final String name = descriptorTag.getAttributeValue(NAME_ATTR_NAME); if (descriptor != null && name != null) { final String substitutionValue = ((XmlTag)descriptor.getDeclaration()).getAttributeValue("substitutionGroup"); if (substitutionValue != null && name.equals(XmlUtil.findLocalNameByQualifiedName(substitutionValue))) { return true; // could be more parent-child relation complex!!! } } } } for (XmlTag subTag : tag.getSubTags()) { if (_canContainTag(localName, namespace, subTag, context, visited, info, restriction)) return true; } return false; }
_canContainTag
299,867
CanContainAttributeType (String namespace, @Nullable String qName) { if (qName == null) { return myAnyAttributeCache.get(namespace).getValue(); } return _canContainAttribute(namespace, myTag, qName, new HashSet<>(), null); }
canContainAttribute
299,868
CanContainAttributeType (String namespace, @NotNull XmlTag tag, @Nullable String qName, Set<String> visited, @Nullable Set<Object> dependencies) { if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "anyAttribute")) { if (dependencies != null) { dependencies.add(tag.getContainingFile()); } String ns = tag.getAttributeValue("namespace"); CanContainAttributeType canContainAttributeType = CanContainAttributeType.CanContainButDoNotSkip; if ("skip".equals(tag.getAttributeValue("processContents"))) canContainAttributeType= CanContainAttributeType.CanContainButSkip; if (OTHER_NAMESPACE_ATTR_VALUE.equals(ns)) { return !namespace.equals(myDocumentDescriptor.getDefaultNamespace()) ? canContainAttributeType : CanContainAttributeType.CanNotContain; } else if (ns == null || "##any".equals(ns)) { return CanContainAttributeType.CanContainAny; } return canContainAttributeType; } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "attributeGroup")) { String ref = tag.getAttributeValue(REF_ATTR_NAME); if (ref != null && !visited.contains(ref)) { visited.add(ref); XmlTag groupTag = myDocumentDescriptor.findAttributeGroup(ref); if (groupTag != null) { if (dependencies != null) { dependencies.add(groupTag.getContainingFile()); } final CanContainAttributeType containAttributeType = _canContainAttribute(namespace, groupTag, qName, visited, dependencies); if (containAttributeType != CanContainAttributeType.CanNotContain) return containAttributeType; } } } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "attribute")) { if (qName != null && qName.equals(tag.getAttributeValue(REF_ATTR_NAME))) { return CanContainAttributeType.CanContainButDoNotSkip; } } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, RESTRICTION_TAG_NAME) || XmlNSDescriptorImpl.equalsToSchemaName(tag, EXTENSION_TAG_NAME)) { String base = tag.getAttributeValue(BASE_ATTR_NAME); if (base != null && !visited.contains(base)) { visited.add(base); TypeDescriptor descriptor = myDocumentDescriptor.findTypeDescriptor(base); if (descriptor instanceof ComplexTypeDescriptor complexTypeDescriptor) { if (dependencies != null) { XmlTag declaration = complexTypeDescriptor.getDeclaration(); dependencies.add(declaration.getContainingFile()); } final CanContainAttributeType containAttributeType = complexTypeDescriptor._canContainAttribute(namespace, complexTypeDescriptor.getDeclaration(), qName, visited, dependencies); if (containAttributeType != CanContainAttributeType.CanNotContain) return containAttributeType; } } } final XmlTag[] subTags = tag.getSubTags(); for (XmlTag subTag : subTags) { final CanContainAttributeType containAttributeType = _canContainAttribute(namespace, subTag, qName, visited, dependencies); if (containAttributeType != CanContainAttributeType.CanNotContain) return containAttributeType; } return CanContainAttributeType.CanNotContain; }
_canContainAttribute
299,869
boolean () { return myHasAnyInContentModel; }
hasAnyInContentModel
299,870
int () { if ("simpleType".equals(myTag.getLocalName()) || "true".equals(myTag.getAttributeValue("mixed"))) { return XmlElementDescriptor.CONTENT_TYPE_MIXED; } if (getElements(null).length > 0) return XmlElementDescriptor.CONTENT_TYPE_CHILDREN; for (XmlTag tag : myTag.getSubTags()) { if ("simpleContent".equals(tag.getLocalName())) { return XmlElementDescriptor.CONTENT_TYPE_MIXED; } } return XmlElementDescriptor.CONTENT_TYPE_EMPTY; }
getContentType
299,871
String () { return myTag.getAttributeValue(NAME_ATTR_NAME); }
getTypeName
299,872
String () { return getTypeName(); }
toString
299,873
XmlNSDescriptor () { return myXmlNSDescriptor; }
getNSDescriptor
299,874
XmlElementsGroup () { return null; }
getTopGroup
299,875
PsiElement () { return null; }
getDeclaration
299,876
String (PsiElement context) { return getName(); }
getName
299,877
String () { return myParentDescriptor.getName(); }
getName
299,878
void (PsiElement element) { }
init
299,879
String () { return myParentDescriptor.getQualifiedName(); }
getQualifiedName
299,880
String () { return myParentDescriptor.getDefaultName(); }
getDefaultName
299,881
XmlElementDescriptor[] (XmlTag context) { return myParentDescriptor.getElementsDescriptors(context); }
getElementsDescriptors
299,882
XmlElementDescriptor (XmlTag tag, XmlTag contextTag) { return new AnyXmlElementDescriptor(this, myXmlNSDescriptor); }
getElementDescriptor
299,883
XmlAttributeDescriptor[] (final XmlTag context) { return XmlAttributeDescriptor.EMPTY; }
getAttributesDescriptors
299,884
XmlAttributeDescriptor (final String attributeName, final XmlTag context) { return new AnyXmlAttributeDescriptor(attributeName); }
getAttributeDescriptor
299,885
XmlAttributeDescriptor (XmlAttribute attr) { return myParentDescriptor.getAttributeDescriptor(attr); }
getAttributeDescriptor
299,886
int () { return CONTENT_TYPE_UNKNOWN; }
getContentType
299,887
String () { return null; }
getDefaultValue
299,888
CachedValue<XmlAttlistDecl[]> (final XmlElement owner, Object o) { return CachedValuesManager.getManager(owner.getProject()).createCachedValue(() -> { XmlAttlistDecl[] decls = doCollectAttlistDeclarations(owner); return new CachedValueProvider.Result<>(decls, (Object[])ArrayUtil.append(decls, owner, XmlElement.class)); }); }
compute
299,889
PsiElement () { return myElementDecl; }
getDeclaration
299,890
String (PsiElement context) { return getName(); }
getName
299,891
String () { if (myName!=null) return myName; return myName = myElementDecl.getName(); }
getName
299,892
void (PsiElement element) { myElementDecl = (XmlElementDecl) element; }
init
299,893
XmlNSDescriptor () { return getNsDescriptorFrom(myElementDecl); }
getNSDescriptor
299,894
XmlElementDescriptor[] (final XmlTag context) { final LinkedHashSet<XmlElementDescriptor> result = new LinkedHashSet<>(); final XmlElementContentSpec contentSpecElement = myElementDecl.getContentSpecElement(); final XmlNSDescriptor nsDescriptor = getNSDescriptor(); final XmlNSDescriptor NSDescriptor = nsDescriptor != null? nsDescriptor:getNsDescriptorFrom(context); XmlUtil.processXmlElements(contentSpecElement, new PsiElementProcessor(){ @Override public boolean execute(@NotNull PsiElement child){ if (child instanceof XmlToken token) { if (token.getTokenType() == XmlTokenType.XML_NAME) { final String text = child.getText(); XmlElementDescriptor element = getElementDescriptor(text, NSDescriptor); if (element != null) { result.add(element); } } else if (token.getTokenType() == XmlTokenType.XML_CONTENT_ANY) { if (NSDescriptor instanceof XmlNSDescriptorImpl) { ContainerUtil.addAll(result, ((XmlNSDescriptorImpl)NSDescriptor).getElements()); } else if (NSDescriptor instanceof XmlNSDescriptorSequence) { for (XmlNSDescriptor xmlNSDescriptor : ((XmlNSDescriptorSequence)NSDescriptor).getSequence()) { if (xmlNSDescriptor instanceof XmlNSDescriptorImpl) { ContainerUtil.addAll(result, ((XmlNSDescriptorImpl)xmlNSDescriptor).getElements()); } } } } } return true; } }, true, false, XmlUtil.getContainingFile(getDeclaration())); return result.toArray(XmlElementDescriptor.EMPTY_ARRAY); }
doCollectXmlDescriptors
299,895
boolean (@NotNull PsiElement child) { if (child instanceof XmlToken token) { if (token.getTokenType() == XmlTokenType.XML_NAME) { final String text = child.getText(); XmlElementDescriptor element = getElementDescriptor(text, NSDescriptor); if (element != null) { result.add(element); } } else if (token.getTokenType() == XmlTokenType.XML_CONTENT_ANY) { if (NSDescriptor instanceof XmlNSDescriptorImpl) { ContainerUtil.addAll(result, ((XmlNSDescriptorImpl)NSDescriptor).getElements()); } else if (NSDescriptor instanceof XmlNSDescriptorSequence) { for (XmlNSDescriptor xmlNSDescriptor : ((XmlNSDescriptorSequence)NSDescriptor).getSequence()) { if (xmlNSDescriptor instanceof XmlNSDescriptorImpl) { ContainerUtil.addAll(result, ((XmlNSDescriptorImpl)xmlNSDescriptor).getElements()); } } } } } return true; }
execute
299,896
XmlElementDescriptor (final String text, final XmlNSDescriptor NSDescriptor) { XmlElementDescriptor element = null; if (NSDescriptor instanceof XmlNSDescriptorImpl) { element = ((XmlNSDescriptorImpl)NSDescriptor).getElementDescriptor(text); } else if (NSDescriptor instanceof XmlNSDescriptorSequence) { final List<XmlNSDescriptor> sequence = ((XmlNSDescriptorSequence)NSDescriptor).getSequence(); for (XmlNSDescriptor xmlNSDescriptor : sequence) { if (xmlNSDescriptor instanceof XmlNSDescriptorImpl) { element = ((XmlNSDescriptorImpl)xmlNSDescriptor).getElementDescriptor(text); if(element != null) break; } } } else { element = null; } return element; }
getElementDescriptor
299,897
XmlAttributeDescriptor[] (final XmlTag context) { final List<XmlAttributeDescriptor> result = new SmartList<>(); for (XmlAttlistDecl attlistDecl : findAttlistDeclarations(getName())) { for (XmlAttributeDecl attributeDecl : attlistDecl.getAttributeDecls()) { final PsiMetaData psiMetaData = attributeDecl.getMetaData(); assert psiMetaData instanceof XmlAttributeDescriptor; result.add((XmlAttributeDescriptor)psiMetaData); } } return result.toArray(XmlAttributeDescriptor.EMPTY); }
collectAttributeDescriptors
299,898
XmlAttlistDecl[] (String elementName) { final List<XmlAttlistDecl> result = new ArrayList<>(); for (final XmlAttlistDecl declaration : getAttlistDeclarations()) { final String name = declaration.getName(); if (name != null && name.equals(elementName)) { result.add(declaration); } } return result.toArray(XmlAttlistDecl.EMPTY_ARRAY); }
findAttlistDeclarations
299,899
XmlAttlistDecl[] () { return getCachedAttributeDeclarations((XmlElement)getDeclaration()); }
getAttlistDeclarations