@Override
  public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
    if (displayText.isEmpty()) {
      return null;
    }
    CharTable charTable = SharedImplUtil.findCharTableByTree(text.getNode());
    final FileElement dummyParent = DummyHolderFactory.createHolder(text.getManager(), null, charTable).getTreeElement();
    final XmlTag rootTag =
      ((XmlFile)PsiFileFactory.getInstance(text.getProject())
        .createFileFromText("a.xml", text.getLanguage(), buildTagForText(text, displayText), false, true)).getRootTag();

    assert rootTag != null;
    final XmlTagChild[] tagChildren = rootTag.getValue().getChildren();

    final XmlTagChild child = tagChildren.length > 0 ? tagChildren[0]:null;
    LOG.assertTrue(child != null, "Child is null for tag: " + rootTag.getText());

    final TreeElement element = (TreeElement)child.getNode();
    DebugUtil.performPsiModification(getClass().getName(), () -> {
      ((TreeElement)tagChildren[tagChildren.length - 1].getNode().getTreeNext()).rawRemoveUpToLast();
      dummyParent.rawAddChildren(element);
    });
    TreeUtil.clearCaches(dummyParent);
    return element.getFirstChildNode();
  }
@Override
  public ASTNode encodeXmlTextContents(String displayText, PsiElement text)