private @NotNull Boolean calculateHasNamespaceDeclarations() {
    final Ref<Boolean> result = new Ref<>(Boolean.FALSE);
    processChildren(element -> {
      if (element instanceof XmlAttribute
          && ((XmlAttribute)element).isNamespaceDeclaration()) {
        result.set(Boolean.TRUE);
        return false;
      }
      return !(element instanceof XmlToken)
             || ((XmlToken)element).getTokenType() != XmlTokenType.XML_TAG_END;
    });
    return result.get();
  }
private @NotNull Boolean calculateHasNamespaceDeclarations()