void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<b>1</b>c</html>"); final XmlTag xmlTag = rootTag.findFirstSubTag("b"); WriteCommandAction.runWriteCommandAction(null, () -> xmlTag.delete()); assertEquals("<html>ac</html>", rootTag.getText()); }