public static @Nullable Pair<PsiElement, PsiElement> getNearestText(PsiElement element, ElementIterator iterator) {
    element = iterator.getNext(element);
    if (!(element instanceof XmlText) || element.getChildren().length == 0) {
      return null;
    }
    element = iterator.getFirstChild(element);
    PsiElement first = null;
    PsiElement last = null;
    boolean textPassed = false;
    for (PsiElement current = element; current != null; current = iterator.getNext(current)) {
      if (current instanceof PsiWhiteSpace && current.getText().contains("\n")) {
        if (textPassed) {
          break;
        }
      }
      else if (!(current instanceof PsiComment)) {
        if (first == null) {
          first = current;
        }
        last = current;
        textPassed = true;
      }
    }

    if (!textPassed) {
      return null;
    }
    return iterator.sortOrderedPair(first, last);
  }
public static @Nullable Pair<PsiElement, PsiElement> getNearestText(PsiElement element, ElementIterator iterator)