private static @NotNull Map<String, NullableLazyValue<XmlNSDescriptor>> computeNsDescriptorMap(@NotNull XmlTag tag) {
    Map<String, NullableLazyValue<XmlNSDescriptor>> map = null;
    // XSD aware attributes processing

    final String noNamespaceDeclaration = tag.getAttributeValue("noNamespaceSchemaLocation", XmlUtil.XML_SCHEMA_INSTANCE_URI);
    final String schemaLocationDeclaration = tag.getAttributeValue("schemaLocation", XmlUtil.XML_SCHEMA_INSTANCE_URI);
    final boolean hasNamespaceDeclarations = tag.hasNamespaceDeclarations();

    if (noNamespaceDeclaration != null) {
      map = initializeSchema(tag, XmlUtil.EMPTY_URI, null, Collections.singleton(noNamespaceDeclaration),
                             null, hasNamespaceDeclarations);
    }
    if (schemaLocationDeclaration != null) {
      final StringTokenizer tokenizer = new StringTokenizer(schemaLocationDeclaration);
      while (tokenizer.hasMoreTokens()) {
        final String uri = tokenizer.nextToken();
        if (tokenizer.hasMoreTokens()) {
          map = initializeSchema(tag, uri, getNSVersion(uri, tag), Collections.singleton(tokenizer.nextToken()),
                                 map, hasNamespaceDeclarations);
        }
      }
    }

    // namespace attributes processing (XSD declaration via ExternalResourceManager)
    if (hasNamespaceDeclarations) {
      for (final XmlAttribute attribute : tag.getAttributes()) {
        if (attribute.isNamespaceDeclaration()) {
          String ns = attribute.getValue();
          if (ns == null) ns = XmlUtil.EMPTY_URI;
          ns = tag.getRealNs(ns);

          if (map == null || !map.containsKey(ns)) {
            Set<String> locations = getNsLocations(tag, ns);
            map = initializeSchema(tag, ns, getNSVersion(ns, tag), locations, map, true);
          }
        }
      }
    }
    return map == null ? Collections.emptyMap() : map;
  }
private static @NotNull Map<String, NullableLazyValue<XmlNSDescriptor>> computeNsDescriptorMap(@NotNull XmlTag tag)