Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
299,700
|
boolean () { return true; }
|
askParentDescriptorViaXsi
|
299,701
|
String () { String ns = getNS(); if (ns != null && !ns.isEmpty()) { return ns + ":" + getName(); } return getName(); }
|
getQualifiedName
|
299,702
|
String () { return isQualifiedForm() ? getQualifiedName() : getName(); }
|
getDefaultName
|
299,703
|
boolean () { String value = myDescriptorTag.getAttributeValue("form"); if (value == null) { final PsiFile psiFile = myDescriptorTag.getContainingFile(); XmlTag rootTag = psiFile instanceof XmlFile ?((XmlFile)psiFile).getRootTag():null; if (rootTag != null) { value = rootTag.getAttributeValue(ELEMENT_FORM_DEFAULT); } } return QUALIFIED_ATTR_VALUE.equals(value); }
|
isQualifiedForm
|
299,704
|
boolean () { return isAbstractDeclaration(myDescriptorTag); }
|
isAbstract
|
299,705
|
Boolean (final XmlTag descriptorTag) { return Boolean.valueOf(descriptorTag.getAttributeValue("abstract")); }
|
isAbstractDeclaration
|
299,706
|
void (final Validator<XmlTag> validator) { myValidator = validator; }
|
setValidator
|
299,707
|
void (@NotNull XmlTag context, @NotNull ValidationHost host) { Validator<XmlTag> validator = myValidator; if (validator != null) { validator.validate(context, host); } }
|
validate
|
299,708
|
PsiReference[] (XmlTag xmlTag, @NotNull String text) { XmlTagValue value = xmlTag.getValue(); XmlText[] elements = value.getTextElements(); if (elements.length == 0 || xmlTag.getSubTags().length > 0) return PsiReference.EMPTY_ARRAY; return new XmlEnumeratedReferenceSet(xmlTag, this).getPsiReferences(); }
|
getValueReferences
|
299,709
|
boolean (final String namespace, final XmlTag context) { final TypeDescriptor type = getType(context); if (type instanceof ComplexTypeDescriptor typeDescriptor) { return typeDescriptor.canContainTag("a", namespace, context) || typeDescriptor.getNsDescriptor().hasSubstitutions() || XmlUtil.nsFromTemplateFramework(namespace); } return false; }
|
allowElementsFromNamespace
|
299,710
|
String () { String namespace; try { namespace = getNamespace(); } catch (PsiInvalidElementAccessException e) { namespace = "!!!Invalid!!!"; } return getName() + " (" + namespace + ")"; }
|
toString
|
299,711
|
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; XmlElementDescriptorImpl that = (XmlElementDescriptorImpl)o; if (myDescriptorTag != null ? !myDescriptorTag.equals(that.myDescriptorTag) : that.myDescriptorTag != null) return false; return true; }
|
equals
|
299,712
|
int () { return myDescriptorTag != null ? myDescriptorTag.hashCode() : 0; }
|
hashCode
|
299,713
|
NullElementDescriptor () { return INSTANCE; }
|
getInstance
|
299,714
|
String () { return null; }
|
getQualifiedName
|
299,715
|
String () { return null; }
|
getDefaultName
|
299,716
|
XmlElementDescriptor[] (XmlTag context) { return XmlElementDescriptor.EMPTY_ARRAY; }
|
getElementsDescriptors
|
299,717
|
XmlElementDescriptor (XmlTag childTag, XmlTag contextTag) { return null; }
|
getElementDescriptor
|
299,718
|
XmlAttributeDescriptor[] (final XmlTag context) { return XmlAttributeDescriptor.EMPTY; }
|
getAttributesDescriptors
|
299,719
|
XmlAttributeDescriptor (String attributeName, final XmlTag context) { return null; }
|
getAttributeDescriptor
|
299,720
|
XmlAttributeDescriptor (XmlAttribute attribute) { return null; }
|
getAttributeDescriptor
|
299,721
|
XmlNSDescriptor () { return null; }
|
getNSDescriptor
|
299,722
|
XmlElementsGroup () { return null; }
|
getTopGroup
|
299,723
|
int () { return 0; }
|
getContentType
|
299,724
|
String () { return null; }
|
getDefaultValue
|
299,725
|
PsiElement () { return null; }
|
getDeclaration
|
299,726
|
String (PsiElement context) { return null; }
|
getName
|
299,727
|
String () { return null; }
|
getName
|
299,728
|
void (PsiElement element) { }
|
init
|
299,729
|
List<XmlElementsGroup> () { return mySubGroups; }
|
getSubGroups
|
299,730
|
XmlElementDescriptor () { throw new RuntimeException("not a leaf group"); }
|
getLeafDescriptor
|
299,731
|
void (XmlElementsGroup group) { mySubGroups.add(group); }
|
addSubGroup
|
299,732
|
String () { return getGroupType().toString(); }
|
toString
|
299,733
|
String (PsiElement context) { return myDescriptorTag.getName(); }
|
getName
|
299,734
|
XmlNSDescriptor () { XmlNSDescriptor nsDescriptor = NSDescriptor; if (nsDescriptor ==null) { final XmlFile file = XmlUtil.getContainingFile(getType(null).getDeclaration()); if(file == null) return null; final XmlDocument document = file.getDocument(); if(document == null) return null; NSDescriptor = nsDescriptor = (XmlNSDescriptor)document.getMetaData(); } return nsDescriptor; }
|
getNSDescriptor
|
299,735
|
ComplexTypeDescriptor (XmlElement context) { return myType; }
|
getType
|
299,736
|
String () { XmlTag rootTag = ((XmlFile)getType(null).getDeclaration().getContainingFile()).getDocument().getRootTag(); if (QUALIFIED_ATTR_VALUE.equals(rootTag.getAttributeValue("elementFormDefault"))) { return getQualifiedName(); } return getName(); }
|
getDefaultName
|
299,737
|
boolean () { return false; }
|
askParentDescriptorViaXsi
|
299,738
|
boolean (final Object o) { if (this == o) return true; if (!(o instanceof XmlElementDescriptorByType that)) return false; if (myType != null ? !myType.equals(that.myType) : that.myType != null) return false; return true; }
|
equals
|
299,739
|
int () { return (myType != null ? myType.hashCode() : 0); }
|
hashCode
|
299,740
|
void (final @NotNull XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; final boolean hasRefAttribute = tag.getAttributeValue(REF_ATTR_NAME) != null; if (hasRefAttribute) { for (XmlAttribute attr : tag.getAttributes()) { final String name = attr.getName(); if (name.indexOf(':') == -1 && !MIN_OCCURS_ATTR_NAME.equals(name) && !MAX_OCCURS_ATTR_NAME.equals(name) && !ID_ATTR_NAME.equals(name) && !REF_ATTR_NAME.equals(name)) { host.addMessage( attr.getNameElement(), XmlPsiBundle.message("xml.schema.validation.attr.not.allowed.with.ref", name), ValidationHost.ErrorType.ERROR ); } } } final String minOccursValue = tag.getAttributeValue("minOccurs"); final String maxOccursValue = tag.getAttributeValue(MAX_OCCURS_ATTR_VALUE); if (minOccursValue != null && maxOccursValue != null) { try { final int minOccurs = Integer.parseInt(minOccursValue); final int maxOccurs = Integer.parseInt(maxOccursValue); if (maxOccurs < minOccurs) { host.addMessage( tag.getAttribute(MAX_OCCURS_ATTR_VALUE, null).getValueElement(), XmlPsiBundle.message("xml.schema.validation.max.occurs.should.be.not.less.than.min.occurs"), ValidationHost.ErrorType.ERROR ); } } catch (NumberFormatException e) { // this schema will be reported by xerces validation } } if (!hasRefAttribute && tag.getAttributeValue(NAME_ATTR_NAME) == null) { host.addMessage( tag, XmlPsiBundle.message("xml.schema.validation.name.or.ref.should.present"), ValidationHost.ErrorType.ERROR ); } }
|
validate
|
299,741
|
void (final @NotNull XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; if (tag.getAttributeValue(REF_ATTR_NAME) == null && tag.getAttributeValue(NAME_ATTR_NAME) == null) { host.addMessage( tag, XmlPsiBundle.message("xml.schema.validation.name.or.ref.should.present"), ValidationHost.ErrorType.ERROR ); } if (tag.getAttributeValue(DEFAULT_ATTR_NAME) != null && tag.getAttributeValue(FIXED_ATTR_NAME) != null) { host.addMessage( tag.getAttribute(DEFAULT_ATTR_NAME, null).getNameElement(), XmlPsiBundle.message("xml.schema.validation.default.or.fixed.should.be.specified.but.not.both"), ValidationHost.ErrorType.ERROR ); host.addMessage( tag.getAttribute(FIXED_ATTR_NAME, null).getNameElement(), XmlPsiBundle.message("xml.schema.validation.default.or.fixed.should.be.specified.but.not.both"), ValidationHost.ErrorType.ERROR ); } }
|
validate
|
299,742
|
String (final @NotNull XmlTag t) { return t.getAttributeValue(NAME_ATTR_NAME); }
|
getName
|
299,743
|
String (final @NotNull XmlTag t, @NotNull String name) { return name; }
|
getNameKey
|
299,744
|
PsiElement (final @NotNull XmlTag t) { return t.getAttribute(NAME_ATTR_NAME, null).getValueElement(); }
|
getNodeForMessage
|
299,745
|
void (final @NotNull XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; final String nsPrefix = tag.getNamespacePrefix(); final XmlTag[] attrDeclTags = tag.findSubTags((nsPrefix.length() > 0 ? nsPrefix + ":" : "") + "attribute"); XmlUtil.doDuplicationCheckForElements( attrDeclTags, new HashMap<>(attrDeclTags.length), SCHEMA_ATTR_DUP_INFO_PROVIDER, host ); final XmlTag[] elementDeclTags = tag.findSubTags((nsPrefix.length() > 0 ? nsPrefix + ":" : "") + "element"); XmlUtil.doDuplicationCheckForElements( elementDeclTags, new HashMap<>(elementDeclTags.length), SCHEMA_ATTR_DUP_INFO_PROVIDER, host ); }
|
validate
|
299,746
|
boolean (final XmlTag tag) { return XmlUtil.XML_SCHEMA_URI.equals(tag.getNamespace()); }
|
isFromSchemaNs
|
299,747
|
XmlElementDescriptor (final XmlTag tag) { final XmlElementDescriptor descriptor = super.createElementDescriptor(tag); String localName = tag.getAttributeValue(NAME_ATTR_NAME); if (ELEMENT_TAG_NAME.equals(localName)) { ((XmlElementDescriptorImpl)descriptor).setValidator(ELEMENT_VALIDATOR); } else if (COMPLEX_TYPE_TAG_NAME.equals(localName) || SCHEMA_TAG_NAME.equals(localName) || SEQUENCE_TAG_NAME.equals(localName)) { ((XmlElementDescriptorImpl)descriptor).setValidator(ELEMENT_AND_ATTR_VALIDATOR); } else if (ATTRIBUTE_TAG_NAME.equals(localName)) { ((XmlElementDescriptorImpl)descriptor).setValidator(ATTRIBUTE_VALIDATOR); } return descriptor; }
|
createElementDescriptor
|
299,748
|
String () { return getDefaultNamespace(); }
|
toString
|
299,749
|
XmlElementsGroup (XmlNSDescriptorImpl descriptor, XmlTag tag) { XmlElementsGroupProcessor processor = new XmlElementsGroupProcessor(descriptor); processor.startProcessing(tag); return processor.getRootGroup(); }
|
computeGroups
|
299,750
|
XmlElementsGroup () { return myGroups.get(0); }
|
getRootGroup
|
299,751
|
String () { return "root"; }
|
toString
|
299,752
|
void (XmlTag tag, String tagName, XmlTag context, XmlTag ref) { XmlElementsGroup.Type type = XmlElementsGroupImpl.getTagType(tag); if (type != null) { XmlElementsGroupImpl group = new XmlElementsGroupImpl(tag, myGroups.peek(), ref); addSubGroup(group); myGroups.push(group); } else if ("element".equals(tagName)) { XmlElementsGroup group = new XmlElementsGroupLeaf(tag, myNsDescriptor.createElementDescriptor(tag), myGroups.peek(), ref); if (!myGroups.empty()) { addSubGroup(group); } else { myGroups.push(group); } } }
|
tagStarted
|
299,753
|
void (XmlTag tag) { if (!myGroups.empty() && XmlElementsGroupImpl.getTagType(tag) != null) { myGroups.pop(); } }
|
tagFinished
|
299,754
|
void (XmlElementsGroup group) { if (!myGroups.empty()) { XmlElementsGroup last = myGroups.peek(); if (last instanceof XmlElementsGroupImpl) { ((XmlElementsGroupImpl)last).addSubGroup(group); } } }
|
addSubGroup
|
299,755
|
XmlTag () { return myTag; }
|
getDeclaration
|
299,756
|
String () { return myTag.getAttributeValue("name"); }
|
getName
|
299,757
|
void (PsiElement element) { myTag = (XmlTag) element; myUse = myTag.getAttributeValue("use"); }
|
init
|
299,758
|
boolean () { return REQUIRED_ATTR_VALUE.equals(myUse); }
|
isRequired
|
299,759
|
boolean (@NonNls String type) { final String attributeValue = getType(); if (attributeValue != null) { if (attributeValue.endsWith(type)) { final String namespacePrefix = myTag.getNamespacePrefix(); if (namespacePrefix.length() > 0) { return attributeValue.equals(namespacePrefix+":"+type); } else { return attributeValue.equals(type); } } } return false; }
|
hasSimpleSchemaType
|
299,760
|
boolean () { return hasSimpleSchemaType("ID"); }
|
hasIdType
|
299,761
|
boolean () { return hasSimpleSchemaType("IDREF"); }
|
hasIdRefType
|
299,762
|
boolean () { return isEnumerated(null); }
|
isEnumerated
|
299,763
|
String (PsiElement context) { String name = getName(); if (context == null) { return name; } final XmlTag rootTag = (((XmlFile) myTag.getContainingFile())).getRootTag(); assert rootTag != null; String targetNs = rootTag.getAttributeValue("targetNamespace"); if (targetNs == null) return name; XmlTag contextTag = (XmlTag)context; if (QUALIFIED_ATTR_VALUE.equals(myTag.getAttributeValue("form")) || QUALIFIED_ATTR_VALUE.equals(rootTag.getAttributeValue("attributeFormDefault")) || shouldBeQualified(targetNs, contextTag)) { final String prefixByNamespace = contextTag.getPrefixByNamespace(targetNs); if (prefixByNamespace!= null && prefixByNamespace.length() > 0) { name = prefixByNamespace + ":" + name; } } return name; }
|
getName
|
299,764
|
boolean (String targetNs, XmlTag contextTag) { boolean attributeShouldBeQualified = false; String contextNs = contextTag.getNamespace(); if (!contextNs.equals(targetNs)) { final XmlElementDescriptor xmlElementDescriptor = contextTag.getDescriptor(); if (xmlElementDescriptor instanceof XmlElementDescriptorImpl elementDescriptor) { final TypeDescriptor type = elementDescriptor.getType(); if (type instanceof ComplexTypeDescriptor typeDescriptor) { if (myReferenceName != null) { return myReferenceName.indexOf(':') != 0; } XmlAttributeDescriptor[] attributes = ((ComplexTypeDescriptor)type).getAttributes(contextTag); if (ArrayUtil.contains(this, attributes)) { return false; } attributeShouldBeQualified = typeDescriptor.canContainAttribute(targetNs, null) != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain; } if (!attributeShouldBeQualified && contextNs.length() == 0 && targetNs.length() > 0) { attributeShouldBeQualified = !targetNs.equals(elementDescriptor.getNamespace()); } } } return attributeShouldBeQualified; }
|
shouldBeQualified
|
299,765
|
String () { return getName(); }
|
toString
|
299,766
|
void (@Nullable XmlTag myTag, @NotNull XmlFile myFile, @NotNull Set<PsiFile> visited) { if (visited.contains(myFile)) return; visited.add( myFile ); if (myTag == null) return; XmlTag[] tags = myTag.getSubTags(); for (final XmlTag tag : tags) { if (equalsToSchemaName(tag, INCLUDE_TAG_NAME) || equalsToSchemaName(tag, IMPORT_TAG_NAME) ) { final String schemaLocation = tag.getAttributeValue("schemaLocation"); if (schemaLocation != null) { final XmlFile xmlFile = XmlUtil.findNamespace(myFile, schemaLocation); addDependency(xmlFile, visited); } } else if (equalsToSchemaName(tag, REDEFINE_TAG_NAME)) { RecursionManager.doPreventingRecursion(tag, false, () -> { final XmlFile file = getRedefinedElementDescriptorFile(tag); addDependency(file, visited); return null; }); } } final String schemaLocationDeclaration = myTag.getAttributeValue("schemaLocation", XmlUtil.XML_SCHEMA_INSTANCE_URI); if(schemaLocationDeclaration != null) { final StringTokenizer tokenizer = new StringTokenizer(schemaLocationDeclaration); while(tokenizer.hasMoreTokens()){ final String uri = tokenizer.nextToken(); if(tokenizer.hasMoreTokens()){ PsiFile resourceLocation = ExternalResourceManager.getInstance().getResourceLocation(tokenizer.nextToken(), myFile, null); if (resourceLocation == null) resourceLocation = ExternalResourceManager.getInstance().getResourceLocation(uri, myFile, null); if (resourceLocation instanceof XmlFile) addDependency((XmlFile)resourceLocation, visited); } } } }
|
collectDependencies
|
299,767
|
void (final XmlFile file, final Set<PsiFile> visited) { if (file != null) { final XmlDocument document = file.getDocument(); collectDependencies(document != null ? document.getRootTag():null, file, visited); } }
|
addDependency
|
299,768
|
boolean (@NotNull String name, @NotNull XmlTag context) { final String namespace = context.getNamespaceByPrefix(XmlUtil.findPrefixByQualifiedName(name)); if(namespace.length() > 0){ return checkSchemaNamespace(namespace); } return XSD_PREFIX.equals(XmlUtil.findPrefixByQualifiedName(name)); }
|
checkSchemaNamespace
|
299,769
|
boolean (String namespace) { return XmlUtil.XML_SCHEMA_URI.equals(namespace) || XmlUtil.XML_SCHEMA_URI2.equals(namespace) || XmlUtil.XML_SCHEMA_URI3.equals(namespace); }
|
checkSchemaNamespace
|
299,770
|
boolean (@NotNull XmlTag context) { LOG.assertTrue(context.isValid()); final String namespace = context.getNamespace(); if (namespace.length() > 0) { return checkSchemaNamespace(namespace); } return StringUtil.startsWithConcatenation(context.getName(), XSD_PREFIX, ":"); }
|
checkSchemaNamespace
|
299,771
|
XmlNSDescriptorImpl (XmlTag rootTag, final String name, XmlNSDescriptorImpl defaultNSDescriptor) { if (name == null) return defaultNSDescriptor; final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(name); if (namespacePrefix.length() > 0) { final String namespace = rootTag.getNamespaceByPrefix(namespacePrefix); final XmlNSDescriptor nsDescriptor = rootTag.getNSDescriptor(namespace, true); if (nsDescriptor instanceof XmlNSDescriptorImpl) { return (XmlNSDescriptorImpl)nsDescriptor; } } return defaultNSDescriptor; }
|
getNSDescriptorToSearchIn
|
299,772
|
boolean (String[] tagNames, PsiElementProcessor<? super XmlTag> processor) { return processTagsInNamespaceInner(myTag, tagNames, processor, null); }
|
processTagsInNamespace
|
299,773
|
boolean (final @NotNull XmlTag rootTag, final String[] tagNames, final PsiElementProcessor<? super XmlTag> processor, Set<? super XmlTag> visitedTags) { if (visitedTags == null) visitedTags = new HashSet<>(3); else if (visitedTags.contains(rootTag)) return true; visitedTags.add(rootTag); XmlTag[] tags = rootTag.getSubTags(); NextTag: for (XmlTag tag : tags) { for(String tagName:tagNames) { if (equalsToSchemaName(tag, tagName)) { final String name = tag.getAttributeValue("name"); if (name != null) { if (!processor.execute(tag)) { return false; } } continue NextTag; } } if (equalsToSchemaName(tag, INCLUDE_TAG_NAME)) { final String schemaLocation = tag.getAttributeValue("schemaLocation"); if (schemaLocation != null) { final XmlFile xmlFile = XmlUtil.findNamespace(rootTag.getContainingFile(), schemaLocation); if (xmlFile != null) { final XmlDocument includedDocument = xmlFile.getDocument(); if (includedDocument != null) { if (!processTagsInNamespaceInner(includedDocument.getRootTag(), tagNames, processor, visitedTags)) return false; } } } } } return true; }
|
processTagsInNamespaceInner
|
299,774
|
boolean (@NotNull XmlTag tag, @NonNls String schemaName) { return schemaName.equals(tag.getLocalName()) && checkSchemaNamespace(tag); }
|
equalsToSchemaName
|
299,775
|
XmlTag (final XmlTag[] tags, final String specialName, final String name, final XmlTag rootTag, final XmlNSDescriptorImpl descriptor, final HashSet<XmlTag> visited) { for (XmlTag tag : tags) { if (equalsToSchemaName(tag, specialName)) { String attribute = tag.getAttributeValue("name"); if (name.equals(attribute) || name.contains(":") && name.substring(name.indexOf(":") + 1).equals(attribute)) { return tag; } } else if (equalsToSchemaName(tag, INCLUDE_TAG_NAME) || ( equalsToSchemaName(tag, IMPORT_TAG_NAME) && rootTag.getNamespaceByPrefix( XmlUtil.findPrefixByQualifiedName(name) ).equals(tag.getAttributeValue("namespace")) ) ) { final String schemaLocation = tag.getAttributeValue("schemaLocation"); if (schemaLocation != null) { final XmlFile xmlFile = XmlUtil.findNamespace(rootTag.getContainingFile(), schemaLocation); if (xmlFile != null) { final XmlDocument document = xmlFile.getDocument(); if (document != null) { final XmlTag rTag = findSpecialTag(name, specialName, document.getRootTag(), descriptor, visited); if (rTag != null) return rTag; } } } } else if (equalsToSchemaName(tag, REDEFINE_TAG_NAME)) { XmlTag rTag = findSpecialTagIn(tag.getSubTags(), specialName, name, rootTag, descriptor, visited); if (rTag != null) return rTag; final XmlNSDescriptorImpl nsDescriptor = getRedefinedElementDescriptor(tag); if (nsDescriptor != null) { final XmlTag redefinedRootTag = ((XmlDocument)nsDescriptor.getDeclaration()).getRootTag(); rTag = findSpecialTagIn(redefinedRootTag.getSubTags(), specialName, name, redefinedRootTag, nsDescriptor, visited); if (rTag != null) return rTag; } } } return null; }
|
findSpecialTagIn
|
299,776
|
XmlNSDescriptorImpl (final XmlTag parentTag) { XmlFile file = getRedefinedElementDescriptorFile(parentTag); if (file != null) { final XmlDocument document = file.getDocument(); final PsiMetaData metaData = document != null ? document.getMetaData():null; if (metaData instanceof XmlNSDescriptorImpl) return (XmlNSDescriptorImpl)metaData; } return null; }
|
getRedefinedElementDescriptor
|
299,777
|
XmlFile (final XmlTag parentTag) { XmlAttribute attribute = parentTag.getAttribute(XmlUtil.SCHEMA_LOCATION_ATT); if (attribute != null) { XmlAttributeValue element = attribute.getValueElement(); PsiElement psiElement = new URLReference(element).resolve(); if (psiElement instanceof XmlFile) { return ((XmlFile)psiElement); } } return null; }
|
getRedefinedElementDescriptorFile
|
299,778
|
XmlFile () { return myFile; }
|
getDescriptorFile
|
299,779
|
String () { return myTargetNamespace != null ? myTargetNamespace : ""; }
|
getDefaultNamespace
|
299,780
|
XmlElementDescriptor (final XmlTag tag) { return new XmlElementDescriptorImpl(tag); }
|
createElementDescriptor
|
299,781
|
boolean (String localName, String namespace, String fqn, XmlTag context) { final String localAttrName = XmlUtil.findLocalNameByQualifiedName(fqn); if (!localAttrName.equals(localName)) return false; final String attrNamespace = context.getNamespaceByPrefix(XmlUtil.findPrefixByQualifiedName(fqn)); if (attrNamespace.equals(namespace)) return true; if(myTargetNamespace == null){ if(XmlUtil.EMPTY_URI.equals(attrNamespace)) return true; } else { if (myTargetNamespace.equals(namespace)) return true; return context.getNSDescriptor(namespace, true) == this; // schema's targetNamespace could be different from file systemId } return false; }
|
checkElementNameEquivalence
|
299,782
|
TypeDescriptor (XmlTag descriptorTag) { String type = descriptorTag.getAttributeValue("type"); if (type != null) { return getTypeDescriptor(type, descriptorTag); } return findTypeDescriptorImpl(descriptorTag, null, null); }
|
getTypeDescriptor
|
299,783
|
TypeDescriptor (@NotNull String name, XmlTag context) { if(checkSchemaNamespace(name, context)){ final String localNameByQualifiedName = XmlUtil.findLocalNameByQualifiedName(name); if (STD_TYPES.contains(localNameByQualifiedName) && ( name.length() == localNameByQualifiedName.length() || UNDECLARED_STD_TYPES.contains(localNameByQualifiedName) ) ) return new StdTypeDescriptor(localNameByQualifiedName); } return findTypeDescriptor(name, context); }
|
getTypeDescriptor
|
299,784
|
TypeDescriptor (final XmlTag[] tags, final String name, final String namespace, final Pair<QNameKey, XmlTag> pair, final XmlTag rootTag) { for (final XmlTag tag : tags) { if (equalsToSchemaName(tag, "complexType")) { if (name == null) { CachedValue<TypeDescriptor> value = createAndPutTypesCachedValue(tag, pair); return value.getValue(); } String nameAttribute = tag.getAttributeValue("name"); if (isSameName(name, namespace, nameAttribute)) { CachedValue<TypeDescriptor> cachedValue = createAndPutTypesCachedValue(tag, pair); return cachedValue.getValue(); } } else if (equalsToSchemaName(tag, "simpleType")) { if (name == null) { CachedValue<TypeDescriptor> value = createAndPutTypesCachedValueSimpleType(tag, pair); return value.getValue(); } String nameAttribute = tag.getAttributeValue("name"); if (isSameName(name, namespace, nameAttribute)) { CachedValue<TypeDescriptor> cachedValue = createAndPutTypesCachedValue(tag, pair); return cachedValue.getValue(); } } else if (equalsToSchemaName(tag, INCLUDE_TAG_NAME) || (equalsToSchemaName(tag, IMPORT_TAG_NAME) && (namespace == null || !namespace.equals(getDefaultNamespace())) ) ) { final String schemaLocation = tag.getAttributeValue("schemaLocation"); if (schemaLocation != null) { final XmlFile xmlFile = XmlUtil.findNamespace(rootTag.getContainingFile(), schemaLocation); if (xmlFile != null) { final XmlDocument document = xmlFile.getDocument(); if (document != null) { final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(() -> { final String currentName = tag.getAttributeValue("name"); if (( currentName != null && !currentName.equals(XmlUtil.findLocalNameByQualifiedName(name)) ) || !xmlFile.isValid() || xmlFile.getDocument() == null ) { myTypesMap.remove(pair); return new CachedValueProvider.Result<>(null, PsiModificationTracker.MODIFICATION_COUNT); } final XmlDocument document1 = xmlFile.getDocument(); final XmlNSDescriptorImpl nsDescriptor = findNSDescriptor(tag, document1); if (nsDescriptor == null) { myTypesMap.remove(pair); return new CachedValueProvider.Result<>(null, PsiModificationTracker.MODIFICATION_COUNT); } final XmlTag rTag = document1.getRootTag(); final TypeDescriptor complexTypeDescriptor = nsDescriptor.findTypeDescriptorImpl(rTag, name, namespace); return new CachedValueProvider.Result<>(complexTypeDescriptor, rTag); }, false ); TypeDescriptor type = value.getValue(); if (type != null) { myTypesMap.put(pair, value); return type; } } } } } else if (equalsToSchemaName(tag, REDEFINE_TAG_NAME)) { final XmlTag[] subTags = tag.getSubTags(); TypeDescriptor descriptor = doFindIn(subTags, name, namespace, pair, rootTag); if (descriptor != null) return descriptor; final XmlNSDescriptorImpl nsDescriptor = getRedefinedElementDescriptor(tag); if (nsDescriptor != null) { final XmlTag redefinedRootTag = ((XmlDocument)nsDescriptor.getDeclaration()).getRootTag(); descriptor = doFindIn(redefinedRootTag.getSubTags(), name, namespace, pair, redefinedRootTag); if (descriptor instanceof ComplexTypeDescriptor) { TypeDescriptor finalDescriptor = descriptor; CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(() -> { RedefinedTypeDescriptor typeDescriptor = new RedefinedTypeDescriptor((ComplexTypeDescriptor)finalDescriptor, this, nsDescriptor); return CachedValueProvider.Result.create(typeDescriptor, PsiModificationTracker.MODIFICATION_COUNT); }); myTypesMap.put(pair, value); return value.getValue(); } if (descriptor != null) { return descriptor; } } } } return null; }
|
doFindIn
|
299,785
|
boolean (@NotNull String name, String namespace, String nameAttribute) { return nameAttribute != null && (nameAttribute.equals(name) || (name.contains(":") && nameAttribute.equals(name.substring(name.indexOf(":") + 1)))) && (namespace == null || namespace.length() == 0 || namespace.equals(getDefaultNamespace())) ; }
|
isSameName
|
299,786
|
XmlNSDescriptorImpl (final XmlTag tag, final XmlDocument document) { final XmlNSDescriptorImpl nsDescriptor; if(IMPORT_TAG_NAME.equals(tag.getLocalName())) { final XmlNSDescriptor importedDescriptor = (XmlNSDescriptor)document.getMetaData(); nsDescriptor = (importedDescriptor instanceof XmlNSDescriptorImpl) ? (XmlNSDescriptorImpl)importedDescriptor: this; } else { nsDescriptor = this; } return nsDescriptor; }
|
findNSDescriptor
|
299,787
|
CachedValue<TypeDescriptor> (final XmlTag tag, final Pair<QNameKey, XmlTag> pair) { final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(() -> { final SimpleTypeDescriptor simpleTypeDescriptor = new SimpleTypeDescriptor(tag); return new CachedValueProvider.Result<>(simpleTypeDescriptor, tag); }, false); myTypesMap.put(pair, value); return value; }
|
createAndPutTypesCachedValueSimpleType
|
299,788
|
CachedValue<TypeDescriptor> (final XmlTag tag, final Pair<QNameKey, XmlTag> pair) { final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue( () -> { final String name = tag.getAttributeValue("name"); if (name != null && pair.first != null && pair.first.first != null && !name.equals(XmlUtil.findLocalNameByQualifiedName(pair.first.first)) ) { myTypesMap.remove(pair); return new CachedValueProvider.Result<>(null, PsiModificationTracker.MODIFICATION_COUNT); } final ComplexTypeDescriptor complexTypeDescriptor = new ComplexTypeDescriptor(this, tag); return new CachedValueProvider.Result<>(complexTypeDescriptor, tag); }, false); myTypesMap.put(pair, value); return value; }
|
createAndPutTypesCachedValue
|
299,789
|
XmlElementDescriptor (@NotNull XmlTag tag) { PsiElement parent = tag.getParent(); final String namespace = tag.getNamespace(); while(parent instanceof XmlTag && !namespace.equals(((XmlTag)parent).getNamespace())) parent = parent.getContext(); if (parent instanceof XmlTag parentTag) { final XmlElementDescriptor parentDescriptor = parentTag.getDescriptor(); if(parentDescriptor != null){ XmlElementDescriptor elementDescriptorFromParent = parentDescriptor.getElementDescriptor(tag, parentTag); if (elementDescriptorFromParent == null) { elementDescriptorFromParent = getDescriptorFromParent(tag, null); } if (elementDescriptorFromParent instanceof AnyXmlElementDescriptor) { final XmlElementDescriptor elementDescriptor = getElementDescriptor(tag.getLocalName(), namespace); if (elementDescriptor != null) return elementDescriptor; } return elementDescriptorFromParent; } else{ return null; } } else { XmlElementDescriptor elementDescriptor = getElementDescriptor(tag.getLocalName(), tag.getNamespace()); if (elementDescriptor == null) { elementDescriptor = getDescriptorFromParent(tag, null); } return elementDescriptor; } }
|
getElementDescriptor
|
299,790
|
boolean (final @NotNull XmlTag element) { ContainerUtil.addIfNotNull(result, getElementDescriptor(element.getAttributeValue("name"), getDefaultNamespace())); return true; }
|
execute
|
299,791
|
boolean (final @NotNull XmlTag element) { if (!XmlElementDescriptorImpl.isAbstractDeclaration(element)) return super.execute(element); return true; }
|
execute
|
299,792
|
XmlAttributeDescriptor[] (final XmlTag context) { if (myTag == null) return XmlAttributeDescriptor.EMPTY; return CachedValuesManager.getProjectPsiDependentCache(myTag, XmlNSDescriptorImpl::computeAttributeDescriptors) .toArray(XmlAttributeDescriptor.EMPTY); }
|
getRootAttributeDescriptors
|
299,793
|
List<XmlAttributeDescriptor> (XmlTag tag) { List<XmlAttributeDescriptor> result = new ArrayList<>(); processTagsInNamespaceInner(tag, new String[] {ATTRIBUTE_TAG_NAME}, element -> result.add(new XmlAttributeDescriptorImpl(element)), null); return result; }
|
computeAttributeDescriptors
|
299,794
|
boolean () { if (mySubstitutions == null && myTag != null) { mySubstitutions = new MultiMap<>(); XmlTag[] tags = myTag.getSubTags(); for (XmlTag tag : tags) { if (equalsToSchemaName(tag, ELEMENT_TAG_NAME)) { final String substAttr = tag.getAttributeValue("substitutionGroup"); if (substAttr != null) { String substLocalName = XmlUtil.findLocalNameByQualifiedName(substAttr); mySubstitutions.putValue(substLocalName, tag); } } } } return mySubstitutions != null; }
|
initSubstitutes
|
299,795
|
PsiElement () { return myFile.getDocument(); }
|
getDeclaration
|
299,796
|
String (PsiElement context) { return getName(); }
|
getName
|
299,797
|
String () { return ""; }
|
getName
|
299,798
|
void (PsiElement element) { myFile = (XmlFile) element.getContainingFile(); if (element instanceof XmlTag) { myTag = (XmlTag)element; } else { final XmlDocument document = myFile.getDocument(); if (document != null) { myTag = document.getRootTag(); } } if (myTag != null) { myTargetNamespace = myTag.getAttributeValue("targetNamespace"); } Set<PsiFile> dependenciesSet = new HashSet<>(); collectDependencies(myTag, myFile, dependenciesSet); dependencies = ArrayUtil.toObjectArray(dependenciesSet); }
|
init
|
299,799
|
void (@NotNull XmlDocument context, @NotNull Validator.ValidationHost host) { ExternalDocumentValidator.doValidation(context,host); }
|
validate
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.