void () { final XmlFile file = (XmlFile)createFile("file.xml", """ <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <a> <child-element xxx="239"/> </a>"""); final DomFileElementImpl<MyElement> fileElement = getDomManager().getFileElement(file, MyElement.class, "a"); myCallRegistry.clear(); final MyElement rootElement = fileElement.getRootElement(); final MyElement oldLeaf = rootElement.getChildElements().get(0); final GenericAttributeValue<String> xxx = oldLeaf.getXxx(); final XmlTag oldLeafTag = oldLeaf.getXmlTag(); WriteCommandAction.runWriteCommandAction(getProject(), () -> oldLeafTag.delete()); assertFalse(oldLeaf.isValid()); assertFalse(xxx.isValid()); }