void (@NotNull XmlAttribute attribute) { PsiFile file = holder.getFile(); if (!(file instanceof XmlFile)) return; XmlRefCountHolder refCountHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file); if (refCountHolder == null) return; if (!attribute.isNamespaceDeclaration()) { checkUnusedLocations(attribute, holder, refCountHolder); return; } String namespace = attribute.getValue(); String declaredPrefix = getDeclaredPrefix(attribute); if (namespace != null && !refCountHolder.isInUse(declaredPrefix)) { for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) { if (provider.isImplicitUsage(attribute)) return; } XmlAttributeValue value = attribute.getValueElement(); assert value != null; holder.registerProblem(attribute, XmlAnalysisBundle.message("xml.inspections.unused.schema.declaration"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, false, !refCountHolder.isUsedNamespace(namespace))); XmlTag parent = attribute.getParent(); if (declaredPrefix.isEmpty()) { XmlAttribute location = getDefaultLocation(parent); if (location != null) { holder.registerProblem(location, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } else if (!refCountHolder.isUsedNamespace(namespace)) { for (PsiReference reference : getLocationReferences(namespace, parent)) { if (!XmlHighlightVisitor.hasBadResolve(reference, false)) holder.registerProblemForReference(reference, ProblemHighlightType.LIKE_UNUSED_SYMBOL, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } } }