private static boolean shouldReplace(XmlTag tag, XmlTag tag1, int offset) {
    if (tag1 == null || tag1 == tag || tag1.getTextOffset() <= tag.getTextOffset()) return false;
    if (hasUnclosedParent(tag1)) return true;
    if (XmlUtil.getTokenOfType(tag1, XmlTokenType.XML_EMPTY_ELEMENT_END) != null) return false;
    XmlToken element = XmlTagUtil.getEndTagNameElement(tag1);
    return element != null && element.getTextOffset() > offset;
  }
private static boolean shouldReplace(XmlTag tag, XmlTag tag1, int offset)