public static XmlTagValue createXmlTagValue(XmlTag tag) {
    final List<XmlTagChild> bodyElements = new ArrayList<>();

    tag.processElements(new PsiElementProcessor() {
      boolean insideBody;
      @Override
      public boolean execute(@NotNull PsiElement element) {
        final ASTNode treeElement = element.getNode();
        if (insideBody) {
          if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_END_TAG_START) return false;
          if (!(element instanceof XmlTagChild)) return true;
          bodyElements.add((XmlTagChild)element);
        }
        else if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_TAG_END) insideBody = true;
        return true;
      }
    }, tag);

    XmlTagChild[] tagChildren = bodyElements.toArray(XmlTagChild.EMPTY_ARRAY);
    return new XmlTagValueImpl(tagChildren, tag);
  }
public static XmlTagValue createXmlTagValue(XmlTag tag)