void () { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>a <b>123 <z/> ff</b> c</a>"); XmlTag bTag = aTag.findFirstSubTag("b"); CodeStyle.getSettings(getProject()).getCustomSettings(XmlCodeStyleSettings.class).XML_KEEP_WHITESPACES = true; XmlTagChild[] valueChildren = bTag.getValue().getChildren(); aTag.addRangeBefore(valueChildren[0], valueChildren[valueChildren.length - 1], bTag); WriteCommandAction.runWriteCommandAction(null, () -> bTag.delete()); assertEquals("<a>a 123 <z/> ff c</a>", aTag.getText()); }