XmlTag () { final XmlTag[] result = new XmlTag[]{null}; getManager().runChange(() -> { try { final String namespace = getXmlElementNamespace(); final @NonNls String nsDecl = StringUtil.isEmpty(namespace) ? "" : " xmlns=\"" + namespace + "\""; final XmlFile xmlFile = getFile(); final XmlTag tag = XmlElementFactory.getInstance(xmlFile.getProject()).createTagFromText("<" + getXmlElementName() + nsDecl + "/>"); result[0] = ((XmlDocument)xmlFile.getDocument().replace(((XmlFile)tag.getContainingFile()).getDocument())).getRootTag(); } catch (IncorrectOperationException e) { LOG.error(e); } }); return result[0]; }